46efd24
%global modname grako
46efd24
%global modfirst %(c=%{modname}; echo ${c:0:1})
46efd24
46efd24
Name:           python-%{modname}
46efd24
Version:        3.18.1
31150f0
Release:        9%{?dist}
46efd24
Summary:        Python grammar compiler, EBNF input, PEG/Packrat parser output
46efd24
46efd24
License:        BSD
46efd24
URL:            https://pypi.python.org/pypi/%{modname}/
46efd24
Source0:        https://pypi.io/packages/source/%{modfirst}/%{modname}/%{modname}-%{version}.tar.gz
46efd24
46efd24
BuildArch:      noarch
46efd24
BuildRequires:  python%{python3_pkgversion}-devel
46efd24
BuildRequires:  python%{python3_pkgversion}-setuptools
46efd24
# needed for tests:
46efd24
BuildRequires:  python%{python3_pkgversion}-pytest
46efd24
46efd24
%description
46efd24
Grako (for "grammar compiler") takes a grammar in a variation of EBNF
46efd24
as input, and outputs a memoizing PEG/Packrat parser in Python.
46efd24
46efd24
%package -n python%{python3_pkgversion}-%{modname}
46efd24
Summary:        %{summary}
46efd24
Requires:       python%{python3_pkgversion}-pygraphviz
46efd24
%{?python_provide:%python_provide python%{python3_pkgversion}-%{modname}}
46efd24
46efd24
%description -n python%{python3_pkgversion}-%{modname}
46efd24
Grako (for "grammar compiler") takes a grammar in a variation of EBNF
46efd24
as input, and outputs a memoizing PEG/Packrat parser in Python.
46efd24
46efd24
46efd24
%prep
46efd24
%setup -q -n %{modname}-%{version}
46efd24
46efd24
# Edit Makefiles to invoke python3 explicitly, rather than just python.
46efd24
# This ensures that we run the tests using the python3 interpreter.
46efd24
find . -name Makefile -exec sed -i 's/python[ \t]/python3 /g' {} +
46efd24
46efd24
# Fix Python shebang lines
46efd24
find -type f -exec sed -i '1s=^#!/usr\(/env\|/bin\)* python[23]\?=#!/usr/bin/python3=' {} +
46efd24
46efd24
# Don't package examples/antlr2grako/.ropeproject 
46efd24
rm -rf examples/antlr2grako/.ropeproject
46efd24
46efd24
46efd24
%build
46efd24
%py3_build
46efd24
46efd24
46efd24
%install
46efd24
%py3_install
46efd24
# install loses the executable permission on bootstrap.py, so fix
46efd24
chmod a+x %{buildroot}%{python3_sitelib}/%{modname}/bootstrap.py
46efd24
46efd24
46efd24
%check
46efd24
# make directory needed for bootstrap test
46efd24
mkdir tmp
46efd24
make test
46efd24
46efd24
# Examples are packaged as documentation, not intended to run in place
46efd24
# from the doc dir, so they should not be prebuilt. After check, clean
46efd24
# and remove bytecode.
46efd24
for e in antlr2grako calc regex
46efd24
do
46efd24
  pushd examples/$e
46efd24
  make clean
46efd24
  rm -rf __pycache__ */__pycache__
46efd24
  popd
46efd24
done
46efd24
46efd24
46efd24
%files -n python%{python3_pkgversion}-%{modname}
46efd24
%license LICENSE.txt
46efd24
%doc DESCRIPTION.rst README.md
46efd24
%doc examples
46efd24
%{_bindir}/%{modname}
46efd24
%{python3_sitelib}/%{modname}
46efd24
%{python3_sitelib}/%{modname}-%{version}-py?.?.egg-info
46efd24
46efd24
46efd24
%changelog
31150f0
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-9
31150f0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
31150f0
45fccfb
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-8
45fccfb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
45fccfb
ba69f71
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-7
ba69f71
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
ba69f71
0966d91
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.18.1-6
0966d91
- Rebuilt for Python 3.7
0966d91
894116d
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-5
894116d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
894116d
971bbce
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-4
971bbce
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
971bbce
fb3339c
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-3
fb3339c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
fb3339c
7497ca5
* Thu Dec 22 2016 Miro Hrončok <mhroncok@redhat.com> - 3.18.1-2
7497ca5
- Rebuild for Python 3.6
7497ca5
46efd24
* Fri Dec 16 2016 Eric Smith <brouhaha@fedoraproject.org> 3.18.1-1
46efd24
- Updated to latest upstream.
46efd24
- Use find and sed to replace shebang lines in python scripts based on
46efd24
  http://python-rpm-porting.readthedocs.io/en/latest/applications.html#fixing-shebangs
46efd24
- Use find and sed to change "python" in Makefiles to "python3".
46efd24
46efd24
* Wed Dec 14 2016 Eric Smith <brouhaha@fedoraproject.org> 3.18.0-4
46efd24
- Moved check section to follow install section in spec.
46efd24
- Use pushd/popd rather than cd in check section.
46efd24
46efd24
* Tue Dec 13 2016 Eric Smith <brouhaha@fedoraproject.org> 3.18.0-3
46efd24
- Fix dependency on python3-pygraphviz, and move into subpackage.
46efd24
- Fix shebang lines of examples.
46efd24
- Clean examples after check.
46efd24
46efd24
* Mon Dec 12 2016 Eric Smith <brouhaha@fedoraproject.org> 3.18.0-2
46efd24
- Add dependency on python3-pygraphviz per package review.
46efd24
- Add a "mkdir tmp" so diagram test passes.
46efd24
- Added examples directory as doc.
46efd24
46efd24
* Sat Dec 10 2016 Eric Smith <brouhaha@fedoraproject.org> 3.18.0-1
46efd24
- Updated to latest upstream
46efd24
- Changes per package review (#1401276).
46efd24
46efd24
* Sun Dec 04 2016 Eric Smith <brouhaha@fedoraproject.org> 3.17.0-1
46efd24
- Initial version.