Ship python2-pycparser

Modernize spec
This commit is contained in:
Orion Poplawski 2017-01-06 16:15:00 -07:00
parent e840c4099b
commit 3842551cef
2 changed files with 30 additions and 28 deletions

View File

@ -1,13 +1,11 @@
%if 0%{?fedora} > 12 %if 0%{?fedora}
%global with_python3 1 %global with_python3 1
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif %endif
Name: python-pycparser Name: python-pycparser
Summary: C parser and AST generator written in Python Summary: C parser and AST generator written in Python
Version: 2.14 Version: 2.14
Release: 8%{?dist} Release: 9%{?dist}
License: BSD License: BSD
Group: System Environment/Libraries Group: System Environment/Libraries
URL: http://github.com/eliben/pycparser URL: http://github.com/eliben/pycparser
@ -33,18 +31,28 @@ BuildRequires: python3-devel python3-setuptools
BuildRequires: python3-ply BuildRequires: python3-ply
%endif # if with_python3 %endif # if with_python3
Requires: python-ply >= 3.6
%description %description
pycparser is a complete parser for the C language, written in pure Python. pycparser is a complete parser for the C language, written in pure Python.
It is a module designed to be easily integrated into applications that It is a module designed to be easily integrated into applications that
need to parse C source code. need to parse C source code.
%package -n python2-pycparser
Summary: C parser and AST generator written in Python
Group: System Environment/Libraries
Requires: python-ply >= 3.6
%{?python_provide:%python_provide python2-pycparser}
%description -n python2-pycparser
pycparser is a complete parser for the C language, written in pure Python.
It is a module designed to be easily integrated into applications that
need to parse C source code.
%if 0%{?with_python3} %if 0%{?with_python3}
%package -n python3-pycparser %package -n python3-pycparser
Summary: C parser and AST generator written in Python Summary: C parser and AST generator written in Python
Group: System Environment/Libraries Group: System Environment/Libraries
Requires: python3-ply Requires: python3-ply
%{?python_provide:%python_provide python3-pycparser}
%description -n python3-pycparser %description -n python3-pycparser
pycparser is a complete parser for the C language, written in pure Python. pycparser is a complete parser for the C language, written in pure Python.
@ -60,60 +68,55 @@ need to parse C source code.
rm -rf pycparser/ply rm -rf pycparser/ply
# examples # examples
%{__python} %{SOURCE1} examples %{__python2} %{SOURCE1} examples
dos2unix LICENSE dos2unix LICENSE
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|'
%endif # with_python3
%build %build
%{__python} setup.py build %py2_build
pushd build/lib/pycparser pushd build/lib/pycparser
%{__python} _build_tables.py %{__python2} _build_tables.py
popd popd
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} %py3_build
%{__python3} setup.py build
pushd build/lib/pycparser pushd build/lib/pycparser
%{__python3} _build_tables.py %{__python3} _build_tables.py
popd popd
popd
%endif # with_python3 %endif # with_python3
%install %install
%{__python} setup.py install --skip-build --root %{buildroot} %py2_install
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} %py3_install
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3 %endif # with_python3
%check %check
%{__python} tests/all_tests.py %{__python2} tests/all_tests.py
%if 0%{?with_python3} %if 0%{?with_python3}
%{__python3} tests/all_tests.py %{__python3} tests/all_tests.py
pushd %{py3dir}
popd
%endif # with_python3 %endif # with_python3
%files %files -n python2-pycparser
%doc examples LICENSE %license LICENSE
%doc examples
%{python_sitelib}/pycparser/ %{python_sitelib}/pycparser/
%{python_sitelib}/pycparser-*.egg-info %{python_sitelib}/pycparser-*.egg-info
%if 0%{?with_python3} %if 0%{?with_python3}
%files -n python3-pycparser %files -n python3-pycparser
%license LICENSE
%doc examples
%{python3_sitelib}/pycparser/ %{python3_sitelib}/pycparser/
%{python3_sitelib}/pycparser-*.egg-info %{python3_sitelib}/pycparser-*.egg-info
%endif # with_python3 %endif # with_python3
%changelog %changelog
* Fri Jan 6 2017 Orion Poplawski <orion@cora.nwra.com> - 2.14-9
- Ship python2-pycparser
- Modernize spec
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 2.14-8 * Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 2.14-8
- Rebuild for Python 3.6 - Rebuild for Python 3.6

View File

@ -1,2 +1 @@
82ab1fa524198908050550e7780b85e1 release_v2.10.tar.gz
dfa652c012a97ed0168889797873b73f release_v2.14.tar.gz dfa652c012a97ed0168889797873b73f release_v2.14.tar.gz