From 3092267925a07370d07d6b8bfaffce55c9391e8d Mon Sep 17 00:00:00 2001 From: David Shea Date: Thu, 24 Jan 2019 10:26:40 -0500 Subject: [PATCH] Put the python2 package back for EPEL6 and 7. This doesn't change anything on rawhide or f29, and nothing has been built yet for EPEL, so I'm not bumping the release number. --- python-pid-remove-nose-requirement.patch | 9 +++ python-pid.spec | 91 +++++++++++++++++++++--- 2 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 python-pid-remove-nose-requirement.patch diff --git a/python-pid-remove-nose-requirement.patch b/python-pid-remove-nose-requirement.patch new file mode 100644 index 0000000..0ba37b8 --- /dev/null +++ b/python-pid-remove-nose-requirement.patch @@ -0,0 +1,9 @@ +diff -purN pid-2.1.1.orig/setup.py pid-2.1.1/setup.py +--- pid-2.1.1.orig/setup.py 2016-10-05 18:22:33.000000000 -0400 ++++ pid-2.1.1/setup.py 2019-01-24 10:59:54.225382061 -0500 +@@ -54,5 +54,4 @@ setup( + packages=["pid"], + install_requires=[], + test_suite='nose.collector', +- setup_requires=['nose>=1.0'], + ) diff --git a/python-pid.spec b/python-pid.spec index 80c5e98..eb65479 100644 --- a/python-pid.spec +++ b/python-pid.spec @@ -1,5 +1,19 @@ %global srcname pid +# Build python3 for EPEL7, but not 6 +%if 0%{?rhel} && 0%{?rhel} < 7 +%bcond_with python3 +%else +%bcond_without python3 +%endif + +# Do not build python2 for EPEL > 7, Fedora > 28 +%if 0%{?rhel} > 7 || 0%{?fedora} > 28 +%bcond_with python2 +%else +%bcond_without python2 +%endif + Name: python-%{srcname} Version: 2.1.1 Release: 9%{?dist} @@ -9,6 +23,10 @@ License: ASL 2.0 URL: https://pypi.python.org/pypi/%{srcname} Source0: https://pypi.python.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz +# Remove the nose requirement. nose >= 1.0 is not available in EL6, and it's +# only needed to run the testsuite +Patch0: python-pid-remove-nose-requirement.patch + BuildArch: noarch %description @@ -21,16 +39,17 @@ pid provides a PidFile class that manages PID files. PidFile features: PidFile can also be used as a context manager or a decorator. -%package -n python3-%{srcname} +%if %{with python2} +%package -n python2-%{srcname} Summary: PID file management library -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-nose +BuildRequires: python-devel +BuildRequires: python-setuptools +BuildRequires: python-nose -%{?python_provide:%python_provide python3-%{srcname}} +%{?python_provide:%python_provide python2-%{srcname}} -%description -n python3-%{srcname} +%description -n python2-%{srcname} pid provides a PidFile class that manages PID files. PidFile features: - stale detection - locking using fcntl @@ -39,25 +58,79 @@ pid provides a PidFile class that manages PID files. PidFile features: - custom exceptions PidFile can also be used as a context manager or a decorator. +%endif + +%if %{with python3} +%package -n python%{python3_pkgversion}-%{srcname} +Summary: PID file management library + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-nose + +%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} + +%description -n python%{python3_pkgversion}-%{srcname} +pid provides a PidFile class that manages PID files. PidFile features: + - stale detection + - locking using fcntl + - chmod (default is 0o644) + - chown + - custom exceptions + +PidFile can also be used as a context manager or a decorator. +%endif %prep -%autosetup -n %{srcname}-%{version} +# This needs to have a blank line after because of a bug in the EL6 macros +%autosetup -p1 -n %{srcname}-%{version} + rm -rf *.egg-info %build +%if %{with python2} +%py2_build +%endif +%if %{with python3} %py3_build +%endif %install +%if %{with python2} +%py2_install +%endif +%if %{with python3} %py3_install +%endif %check -%{__python3} setup.py test +%if %{with python2} +# Skip the test suite on EL6, nose is too old +%if 0%{?rhel} <= 6 +%else +%{__python2} setup.py test +%endif +%endif -%files -n python3-%{srcname} +%if %{with python3} +%{__python3} setup.py test +%endif + +%if %{with python2} +%files -n python2-%{srcname} +%license LICENSE +%doc AUTHORS CHANGELOG README.rst +%{python2_sitelib}/pid +%{python2_sitelib}/pid*.egg-info* +%endif + +%if %{with python3} +%files -n python%{python3_pkgversion}-%{srcname} %license LICENSE %doc AUTHORS CHANGELOG README.rst %{python3_sitelib}/pid %{python3_sitelib}/pid-*.egg-info +%endif %changelog * Sat Jul 14 2018 Fedora Release Engineering - 2.1.1-9