d8780a
# Ensure that pycparser uses the same YACC __tabversion__ as python-ply
d8780a
# package to prevent "yacc table file version is out of date" problem.
d8780a
%define ply_version %(LC_ALL=C rpm -q --qf '%%{VERSION}' python%{python3_pkgversion}-ply | grep -Eo '^[^.]+\.[^.]+')
d8780a
d8780a
%bcond_without tests
d8780a
d8780a
Name:           python-pycparser
d8780a
Summary:        C parser and AST generator written in Python
d8780a
Version:        2.19
d8780a
Release:        3%{?dist}
d8780a
License:        BSD
d8780a
URL:            http://github.com/eliben/pycparser
d8780a
Source0:        http://github.com/eliben/pycparser/archive/release_v%{version}.tar.gz
d8780a
Source1:        pycparser-0.91.1-remove-relative-sys-path.py
d8780a
d8780a
Patch100:       pycparser-2.10-ply.patch
d8780a
# This is Fedora-specific; I don't think we should request upstream to
d8780a
# remove embedded libraries from their distribuution, when we can remove
d8780a
# them during packaging.
d8780a
d8780a
BuildArch:      noarch
d8780a
# Exclude i686 arch. Due to a modularity issue it's being added to the
d8780a
# x86_64 compose of CRB, but we don't want to ship it at all.
d8780a
# See: https://projects.engineering.redhat.com/browse/RCM-72605
d8780a
ExcludeArch:    i686
d8780a
d8780a
BuildRequires:  python%{python3_pkgversion}-devel
d8780a
BuildRequires:  python%{python3_pkgversion}-setuptools
d8780a
BuildRequires:  dos2unix
d8780a
BuildRequires:  python%{python3_pkgversion}-ply
d8780a
BuildRequires:  python%{python3_pkgversion}-rpm-macros
d8780a
d8780a
# for unit tests
d8780a
%if %{with tests}
d8780a
BuildRequires:  cpp
d8780a
%endif
d8780a
d8780a
%description
d8780a
pycparser is a complete parser for the C language, written in pure Python.
d8780a
It is a module designed to be easily integrated into applications that
d8780a
need to parse C source code.
d8780a
d8780a
%package -n python%{python3_pkgversion}-pycparser
d8780a
Summary:        C parser and AST generator written in Python
d8780a
Requires:       python%{python3_pkgversion}-ply = %{ply_version}
d8780a
%{?python_provide:%python_provide python%{python3_pkgversion}-pycparser}
d8780a
d8780a
%description -n python%{python3_pkgversion}-pycparser
d8780a
pycparser is a complete parser for the C language, written in pure Python.
d8780a
It is a module designed to be easily integrated into applications that
d8780a
need to parse C source code.
d8780a
d8780a
%prep
d8780a
%setup -q -n pycparser-release_v%{version}
d8780a
%patch100 -p1 -F5 -b .ply
d8780a
d8780a
# remove embedded copy of ply
d8780a
rm -rf pycparser/ply
d8780a
d8780a
# examples
d8780a
%{__python3} %{SOURCE1} examples
d8780a
dos2unix LICENSE
d8780a
d8780a
%build
d8780a
%py3_build
d8780a
pushd build/lib/pycparser
d8780a
%{__python3} _build_tables.py
d8780a
popd
d8780a
d8780a
%install
d8780a
%py3_install
d8780a
d8780a
%check
d8780a
%if %{with tests}
d8780a
%{__python3} tests/all_tests.py
d8780a
%endif
d8780a
d8780a
%files -n python%{python3_pkgversion}-pycparser
d8780a
%license LICENSE
d8780a
%doc examples
d8780a
%{python3_sitelib}/pycparser/
d8780a
%{python3_sitelib}/pycparser-*.egg-info/
d8780a
d8780a
%changelog
d8780a
* Fri Dec 13 2019 Tomas Orsava <torsava@redhat.com> - 2.19-3
d8780a
- Exclude unsupported i686 arch
d8780a
d8780a
* Wed Nov 20 2019 Lumír Balhar <lbalhar@redhat.com> - 2.19-2
d8780a
- Adjusted for Python 3.8 module in RHEL 8
d8780a
d8780a
* Fri Nov 08 2019 Lumír Balhar <lbalhar@redhat.com> - 2.19-1
d8780a
- New usptream version 2.19
d8780a
d8780a
* Sun Oct 20 2019 Miro Hrončok <mhroncok@redhat.com> - 2.14-23
d8780a
- Subpackage python2-ply has been removed
d8780a
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
d8780a
d8780a
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2.14-22
d8780a
- Rebuilt for Python 3.8.0rc1 (#1748018)
d8780a
d8780a
* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 2.14-21
d8780a
- Rebuilt for Python 3.8
d8780a
d8780a
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-20
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
d8780a
d8780a
* Mon Jun 10 2019 Marcel Plch <mplch@redhat.com> - 2.14-19
d8780a
- Avoid invalid unicode escape sequences in Py3.8
d8780a
d8780a
* Tue Feb 26 2019 Christian Heimes <cheimes@redhat.com> - 2.14-18
d8780a
- Add build dependency on cpp for unit tests
d8780a
- Add dependency on python-ply version to prevent "yacc table file version is out of date"
d8780a
- Fixes RHBZ#1668230
d8780a
d8780a
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-17
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
d8780a
d8780a
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-16
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
d8780a
d8780a
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.14-15
d8780a
- Rebuilt for Python 3.7
d8780a
d8780a
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.14-14
d8780a
- Update Python 2 dependency declarations to new packaging standards
d8780a
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
d8780a
d8780a
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-13
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
d8780a
d8780a
* Wed Sep 27 2017 Troy Dawson <tdawson@redhat.com> - 2.14-12
d8780a
- Cleanup spec file conditionals
d8780a
d8780a
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-11
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
d8780a
d8780a
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-10
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
d8780a
d8780a
* Fri Jan 6 2017 Orion Poplawski <orion@cora.nwra.com> - 2.14-9
d8780a
- Ship python2-pycparser
d8780a
- Modernize spec
d8780a
d8780a
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 2.14-8
d8780a
- Rebuild for Python 3.6
d8780a
d8780a
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.14-7
d8780a
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
d8780a
d8780a
* Fri Jul  8 2016 Tom Callaway <spot@fedoraproject.org> - 2.14-6
d8780a
- rebuild to update yacctab.py
d8780a
d8780a
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-5
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
d8780a
d8780a
* Tue Oct 13 2015 Robert Kuska <rkuska@redhat.com> - 2.14-4
d8780a
- Rebuilt for Python3.5 rebuild
d8780a
d8780a
* Tue Jul 14 2015 Stephen Gallagher <sgallagh@redhat.com> - 2.14-3
d8780a
- Rebuild alongside python-ply 3.6
d8780a
d8780a
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.14-2
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
d8780a
d8780a
* Tue Jun 09 2015 Nathaniel McCallum <npmccallum@redhat.com> - 2.14-1
d8780a
- Update to 2.14
d8780a
d8780a
* Wed Aug 20 2014 Eric Smith <brouhaha@fedoraproject.org> 2.10-1
d8780a
- Update to latest upstream.
d8780a
d8780a
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.09.1-9
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
d8780a
d8780a
* Mon May 12 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.09.1-8
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
d8780a
d8780a
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.09.1-7
d8780a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
d8780a
d8780a
* Tue Jul 23 2013 Eric Smith <brouhaha@fedoraproject.org> 2.09.1-6
d8780a
- Added Python 3 support.
d8780a
d8780a
* Mon Jul 22 2013 Eric Smith <brouhaha@fedoraproject.org> 2.09.1-5
d8780a
- Renumbered Fedora-specific Patch1 to Patch100
d8780a
- Added new Patch1 to fix table generation when the build system
d8780a
  already has a python-pycparser package installed.
d8780a
- Submitted Patch0 and Patch1 as upstream issues.
d8780a
- Added comments about patches.
d8780a
d8780a
* Sun Jul 21 2013 Eric Smith <brouhaha@fedoraproject.org> 2.09.1-4
d8780a
- Upstream repository is now on github.
d8780a
- Fix rpmlint strange-permission complaint.
d8780a
- Rename patches, Source1 to all start with pycparser-{version}, to
d8780a
  simplify updating patches for future upstream releases.
d8780a
d8780a
* Sun Jul 21 2013 Eric Smith <brouhaha@fedoraproject.org> 2.09.1-3
d8780a
- Run _build_tables.py to build the lextab.py and yacctab.py; otherwise
d8780a
  they have to be regenerated at runtime for no benefit.
d8780a
d8780a
* Tue Mar 19 2013 Jos de Kloe <josdekloe@gmail.com> 2.09.1-2
d8780a
- remove the embedded ply code
d8780a
d8780a
* Fri Jan 18 2013 Scott Tsai <scottt.tw@gmail.com> 2.09.1-1
d8780a
- upstream 2.09.1