46efd24
%global modname grako
46efd24
%global modfirst %(c=%{modname}; echo ${c:0:1})
46efd24
46efd24
Name:           python-%{modname}
6f141ea
Version:        3.99.9
bc02122
Release:        2%{?dist}
46efd24
Summary:        Python grammar compiler, EBNF input, PEG/Packrat parser output
46efd24
46efd24
License:        BSD
46efd24
URL:            https://pypi.python.org/pypi/%{modname}/
6f141ea
Source0:        https://pypi.io/packages/source/%{modfirst}/%{modname}/%{modname}-%{version}.zip
6f141ea
Patch0:         python-grako-3.99.9-fix-collections-import.patch
6f141ea
Patch1:         python-grako-3.99.9-disable-flake8.patch
46efd24
46efd24
BuildArch:      noarch
6f141ea
BuildRequires:  make
46efd24
BuildRequires:  python%{python3_pkgversion}-devel
46efd24
BuildRequires:  python%{python3_pkgversion}-setuptools
46efd24
# needed for tests:
46efd24
BuildRequires:  python%{python3_pkgversion}-pytest
6f141ea
BuildRequires:  python%{python3_pkgversion}-pytest-runner
6f141ea
BuildRequires:  python%{python3_pkgversion}-regex
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
6f141ea
%autosetup -p1 -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
6f141ea
%doc README.rst README.md
46efd24
%doc examples
46efd24
%{_bindir}/%{modname}
46efd24
%{python3_sitelib}/%{modname}
f96d2b6
%{python3_sitelib}/%{modname}-%{version}-py%{python3_version}.egg-info
46efd24
46efd24
46efd24
%changelog
bc02122
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.99.9-2
bc02122
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
bc02122
6f141ea
* Wed Jul 07 2021 David King <amigadave@amigadave.com> - 3.99.9-1
6f141ea
- Update to 3.99.9 (#1697415)
6f141ea
849ff64
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 3.18.1-16
849ff64
- Rebuilt for Python 3.10
849ff64
7c88a22
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-15
7c88a22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
7c88a22
b7c3754
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-14
b7c3754
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
b7c3754
22890f8
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 3.18.1-13
22890f8
- Rebuilt for Python 3.9
22890f8
4b7de7f
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.18.1-12
4b7de7f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
4b7de7f
b1fa1f7
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 3.18.1-11
b1fa1f7
- Rebuilt for Python 3.8.0rc1 (#1748018)
b1fa1f7
4d3e251
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.18.1-10
4d3e251
- Rebuilt for Python 3.8
4d3e251
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.