build Python 3 subpackage also in EPEL 7

This commit is contained in:
Felix Schwarz 2020-04-14 16:06:48 +02:00
commit 5faf74ba0c

View file

@ -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 <fschwarz@fedoraproject.org> - 1.1-3
- also package+run unit tests
- build Python 3 subpackage also in EPEL 7
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild