From 5faf74ba0cb4c8e6e479930ec98a5dfefa491ca1 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 14 Apr 2020 16:06:48 +0200 Subject: [PATCH] build Python 3 subpackage also in EPEL 7 --- python-pyrfc3339.spec | 53 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 14772b2..15a0d46 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -1,5 +1,11 @@ %global srcname pyRFC3339 +%if 0%{?rhel} && (0%{?rhel} <= 7) +%bcond_without python2 +%else +%bcond_with python2 +%endif +%global py3_prefix python%{python3_pkgversion} Name: python-pyrfc3339 Version: 1.1 @@ -15,21 +21,37 @@ Source0: %{pypi_source} Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc1555adce0ecc7bd65509a2249d47e5a41b4/pyrfc3339/tests/tests.py BuildArch: noarch - -BuildRequires: python3-devel +%if %{with python2} +BuildRequires: python2-devel # --- unit tests --- -BuildRequires: python3-nose -BuildRequires: python3-pytz +BuildRequires: python-nose +BuildRequires: pytz +%endif + +BuildRequires: %{py3_prefix}-devel +# --- unit tests --- +BuildRequires: %{py3_prefix}-nose +BuildRequires: %{py3_prefix}-pytz %description This package contains a python library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. -%package -n python3-pyrfc3339 +%if %{with python2} +%package -n python2-pyrfc3339 +Summary: %{summary} +%{?python_provide:%python_provide python2-pyrfc3339} + +%description -n python2-pyrfc3339 +This package contains a Python 2 library to parse and generate +RFC 3339-compliant timestamps using Python datetime.datetime objects. +%endif + +%package -n %{py3_prefix}-pyrfc3339 Summary: Generate and parse RFC 3339 timestamps %{?python_provide:%python_provide python3-pyrfc3339} -%description -n python3-pyrfc3339 +%description -n %{py3_prefix}-pyrfc3339 This package contains a Python 3 library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. @@ -39,17 +61,33 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %autosetup -n %{srcname}-%{version} %build +%if %{with python2} +%py2_build +%endif %py3_build %install +%if %{with python2} +%py2_install +%endif %py3_install %check cp -a %{SOURCE1} . +%if %{with python2} +nosetests-2.7 tests.py +%endif nosetests-%{python3_version} tests.py +%if %{with python2} +%files -n python2-pyrfc3339 +%doc README.rst +%license LICENSE.txt +%{python2_sitelib}/pyrfc3339 +%{python2_sitelib}/%{srcname}-%{version}-*.egg-info +%endif -%files -n python3-pyrfc3339 +%files -n %{py3_prefix}-pyrfc3339 %doc README.rst %license LICENSE.txt %{python3_sitelib}/pyrfc3339 @@ -59,6 +97,7 @@ nosetests-%{python3_version} tests.py %changelog * Tue Apr 14 2020 Felix Schwarz - 1.1-3 - also package+run unit tests +- build Python 3 subpackage also in EPEL 7 * Thu Jan 30 2020 Fedora Release Engineering - 1.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild