update spec file with python3 conditionals making ease to maintain fedora/epel with only one spec file

This commit is contained in:
Itamar Reis Peixoto 2015-12-07 23:52:58 -02:00
commit 3aff58e740

View file

@ -1,8 +1,14 @@
%global srcname pyRFC3339
%if 0%{?fedora}
%bcond_without python3
%else
%bcond_with python3
%endif
Name: python-pyrfc3339
Version: 1.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Generate and parse RFC 3339 timestamps
License: MIT
@ -15,10 +21,12 @@ BuildRequires: python2-devel
BuildRequires: python-nose
BuildRequires: pytz
%if %{with python3}
BuildRequires: python3-devel
# --- unit tests ---
BuildRequires: python3-nose
BuildRequires: python3-pytz
%endif
%description
This package contains a python library to parse and generate
@ -32,6 +40,7 @@ Summary: %{summary}
This package contains a Python 2 library to parse and generate
RFC 3339-compliant timestamps using Python datetime.datetime objects.
%if %{with python3}
%package -n python3-pyrfc3339
Summary: Generate and parse RFC 3339 timestamps
%{?python_provide:%python_provide python3-pyrfc3339}
@ -39,6 +48,7 @@ Summary: Generate and parse RFC 3339 timestamps
%description -n python3-pyrfc3339
This package contains a Python 3 library to parse and generate
RFC 3339-compliant timestamps using Python datetime.datetime objects.
%endif
@ -47,15 +57,21 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects.
%build
%py2_build
%if %{with python3}
%py3_build
%endif
%install
%py2_install
%if %{with python3}
%py3_install
%endif
%check
%{__python2} setup.py test
%if %{with python3}
%{__python3} setup.py test
%endif
%files -n python2-pyrfc3339
@ -64,14 +80,19 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects.
%{python2_sitelib}/pyrfc3339
%{python2_sitelib}/%{srcname}-%{version}-*.egg-info
%if %{with python3}
%files -n python3-pyrfc3339
%doc README.rst
%license LICENSE.txt
%{python3_sitelib}/pyrfc3339
%{python3_sitelib}/%{srcname}-%{version}-*.egg-info
%endif
%changelog
* Thu Dec 03 2015 Robert Buchholz <rbu@goodpoint.de> - 1.0-2
- epel7: Only build python2 package
* Tue Nov 10 2015 James Hogarth <james.hogarth@gmail.com> - 1.0-1
- Add installed tests back as per review
- Update to new 1.0 PyPi release