Update to 2.20

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1810349

Avoid calling `rpm` to get ply version info:

  https://pagure.io/packaging-committee/pull-request/954

Drop no longer needed dos2unix.
Switch to %autosetup.
Switch to %python3.
This commit is contained in:
Miro Hrončok 2020-06-05 22:32:34 +02:00
commit 564c924f13
5 changed files with 71 additions and 59 deletions

View file

@ -1,27 +1,25 @@
# Ensure that pycparser uses the same YACC __tabversion__ as python-ply
# package to prevent "yacc table file version is out of date" problem.
%define ply_version %(LC_ALL=C rpm -q --qf '%%{VERSION}' python3-ply | grep -Eo '^[^.]+\.[^.]+')
%bcond_without tests
Name: python-pycparser
Summary: C parser and AST generator written in Python
Version: 2.19
Release: 3%{?dist}
Version: 2.20
Release: 1%{?dist}
License: BSD
URL: http://github.com/eliben/pycparser
Source0: http://github.com/eliben/pycparser/archive/release_v%{version}.tar.gz
Source0: %{url}/archive/release_v%{version}.tar.gz
Source1: pycparser-0.91.1-remove-relative-sys-path.py
Patch100: pycparser-2.10-ply.patch
# This is Fedora-specific; I don't think we should request upstream to
# remove embedded libraries from their distribuution, when we can remove
# them during packaging.
# It also ensures that pycparser uses the same YACC __tabversion__ as ply
# package to prevent "yacc table file version is out of date" problem.
Patch100: pycparser-unbundle-ply.patch
BuildArch: noarch
BuildRequires: python3-devel python3-setuptools
BuildRequires: dos2unix
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-ply
# for unit tests
@ -35,8 +33,7 @@ It is a module designed to be easily integrated into applications that
need to parse C source code.
%package -n python3-pycparser
Summary: C parser and AST generator written in Python
Requires: python3-ply = %{ply_version}
Summary: %{summary}
%{?python_provide:%python_provide python3-pycparser}
%description -n python3-pycparser
@ -45,20 +42,18 @@ It is a module designed to be easily integrated into applications that
need to parse C source code.
%prep
%setup -q -n pycparser-release_v%{version}
%patch100 -p1 -F5 -b .ply
%autosetup -p1 -n pycparser-release_v%{version}
# remove embedded copy of ply
rm -rf pycparser/ply
rm -r pycparser/ply
# examples
%{__python3} %{SOURCE1} examples
dos2unix LICENSE
# Remove relative sys.path from the examples
%{python3} %{SOURCE1} examples
%build
%py3_build
pushd build/lib/pycparser
%{__python3} _build_tables.py
%{python3} _build_tables.py
popd
%install
@ -66,7 +61,7 @@ popd
%check
%if %{with tests}
%{__python3} tests/all_tests.py
%{python3} tests/all_tests.py
%endif
%files -n python3-pycparser
@ -76,6 +71,9 @@ popd
%{python3_sitelib}/pycparser-*.egg-info/
%changelog
* Fri Jun 05 2020 Miro Hrončok <mhroncok@redhat.com> - 2.20-1
- Update to 2.20 (#1810349)
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 2.19-3
- Rebuilt for Python 3.9