From 2836b04a003b28eb9ad079ea39a695f6ba86f064 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sep 02 2017 16:18:48 +0000 Subject: simplify spec Signed-off-by: Igor Gnatenko --- diff --git a/python-extras.spec b/python-extras.spec index b654fb1..bb6a0e3 100644 --- a/python-extras.spec +++ b/python-extras.spec @@ -1,8 +1,4 @@ -%if 0%{?fedora} -%global with_python3 1 -%endif - -%global with_tests 1 +%bcond_without check Name: python-extras Version: 1.0.0 @@ -14,107 +10,64 @@ URL: https://github.com/testing-cabal/extras Source0: https://pypi.io/packages/source/e/extras/extras-%{version}.tar.gz BuildArch: noarch -BuildRequires: python-devel -BuildRequires: python-setuptools -%if 0%{?with_tests} -BuildRequires: python-testtools -%endif - -%if 0%{?with_python3} -BuildRequires: python3-devel -BuildRequires: python3-setuptools -%if 0%{?with_tests} -BuildRequires: python3-testtools -%endif # with_tests -%endif %global _description\ extras is a set of extensions to the Python standard library, originally\ written to make the code within testtools cleaner, but now split out for\ general use outside of a testing context.\ - %description %_description %package -n python2-extras -Summary: %summary +Summary: %summary %{?python_provide:%python_provide python2-extras} +BuildRequires: python2-devel +BuildRequires: python2-setuptools +%if %{with check} +BuildRequires: python2-testtools +%endif %description -n python2-extras %_description -%if 0%{?with_python3} %package -n python3-extras -Summary: Useful extra bits for Python - -%description -n python3-extras -extras is a set of extensions to the Python standard library, originally -written to make the code within testtools cleaner, but now split out for -general use outside of a testing context. -%endif # with_python3 +Summary: %summary +%{?python_provide:%python_provide python3-extras} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%if %{with check} +BuildRequires: python3-testtools +%endif +%description -n python3-extras %_description %prep %setup -q -n extras-%{version} # Remove bundled egg-info -%if 0%{?with_python3} -rm -rf %{py3dir} -cp -a . %{py3dir} - -find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' -%endif # with_python3 - -find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|' - +rm -vrf *.egg-info %build -%{__python} setup.py build - -%if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py build -popd -%endif # with_python3 - +%py2_build +%py3_build %install - -# Must do the python3 install first because the scripts in /usr/bin are -# overwritten with every setup.py install (and we want the python2 version -# to be the default for now). -%if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT -popd -%endif # with_python3 - -%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +%py2_install +%py3_install %check -%if 0%{?with_tests} -%{__python} setup.py test - -%if 0%{?with_python3} -pushd %{py3dir} +%{__python2} setup.py test %{__python3} setup.py test -popd -%endif # with_python3 -%endif # with_tests - - %files -n python2-extras %license LICENSE %doc NEWS README.rst -# For noarch packages: sitelib -%{python_sitelib}/* +%{python2_sitelib}/extras/ +%{python2_sitelib}/extras-*.egg-info/ -%if 0%{?with_python3} %files -n python3-extras %license LICENSE %doc NEWS README.rst -%{python3_sitelib}/* -%endif # with_python3 - +%{python3_sitelib}/extras/ +%{python3_sitelib}/extras-*.egg-info/ %changelog * Sat Sep 2 2017 Jan Beran - 1.0.0-1