Build for Python3 on EPEL

- Apply the the Python3 on EPEL spec template:
  http://fedoraproject.org/wiki/PackagingDrafts:Python3EPEL
- Modernize the spec a bit (use more macros, no explicit
  buildroot)
This commit is contained in:
Aurélien Bompard 2017-08-16 14:58:51 +02:00
parent 151ef778f5
commit db226233fa

View File

@ -1,80 +1,92 @@
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%if 0%{?fedora}
%global with_python3 1
%endif
%global srcname iso8601
%global sum Simple module to parse ISO 8601 dates
%global pkgdesc \
This module parses the most common forms of ISO 8601 date strings \
(e.g. 2007-01-14T20:34:22+00:00) into datetime objects.
Name: python-%{srcname}
Version: 0.1.11
Release: 6%{?dist}
Summary: Simple module to parse ISO 8601 dates
Release: 7%{?dist}
Summary: %{sum}
License: MIT
URL: http://pypi.python.org/pypi/%{srcname}/
Source0: http://pypi.python.org/packages/source/i/%{srcname}/%{srcname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-srpm-macros
%description
This module parses the most common forms of ISO 8601 date strings
(e.g. 2007-01-14T20:34:22+00:00) into datetime objects.
%description %{pkgdesc}
%package -n python2-iso8601
Summary: Simple module to parse ISO 8601 dates
%{?python_provide:%python_provide python2-iso8601}
%package -n python2-%{srcname}
Summary: %{sum}
%{?python_provide:%python_provide python2-%{srcname}}
# python_provide does not exist in CBS Cloud buildroot
Provides: python-iso8601 = %{version}-%{release}
Obsoletes: python-iso8601 < 0.1.10-6
Provides: python-%{srcname} = %{version}-%{release}
Obsoletes: python-%{srcname} < 0.1.10-6
BuildRequires: python2-devel python-setuptools
%description -n python2-iso8601
This module parses the most common forms of ISO 8601 date strings
(e.g. 2007-01-14T20:34:22+00:00) into datetime objects.
%description -n python2-%{srcname} %{pkgdesc}
%if 0%{?with_python3}
%package -n python3-iso8601
Summary: Simple module to parse ISO 8601 dates
%{?python_provide:%python_provide python3-iso8601}
%package -n python%{python3_pkgversion}-%{srcname}
Summary: %{sum}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
BuildRequires: python3-devel python3-setuptools
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%description -n python3-iso8601
This module parses the most common forms of ISO 8601 date strings
(e.g. 2007-01-14T20:34:22+00:00) into datetime objects.
%description -n python%{python3_pkgversion}-%{srcname} %{pkgdesc}
%if 0%{?with_python3_other}
%package -n python%{python3_other_pkgversion}-%{srcname}
Summary: %{sum}
%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{srcname}}
BuildRequires: python%{python3_other_pkgversion}-devel
BuildRequires: python%{python3_other_pkgversion}-setuptools
%description -n python%{python3_other_pkgversion}-%{srcname} %{pkgdesc}
%endif
%prep
%setup -qn %{srcname}-%{version}
%autosetup -n %{srcname}-%{version}
%build
%{__python2} setup.py build
%if 0%{?with_python3}
%{__python3} setup.py build
%py2_build
%py3_build
%if 0%{?with_python3_other}
%py3_other_build
%endif
%install
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
%if 0%{?with_python3}
%{__python3} setup.py install --skip-build --root %{buildroot}
%py2_install
%py3_install
%if 0%{?with_python3_other}
%py3_other_install
%endif
%files -n python2-iso8601
%files -n python2-%{srcname}
%doc LICENSE README.rst
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-iso8601
%files -n python%{python3_pkgversion}-%{srcname}
%doc LICENSE README.rst
%{python3_sitelib}/*
%if 0%{?with_python3_other}
%files -n python%{python3_other_pkgversion}-%{srcname}
%doc LICENSE README.rst
%{python3_other_sitelib}/*
%endif
%changelog
* Wed Aug 16 2017 Aurelien Bompard <abompard@fedoraproject.org> - 0.1.11-7
- Build for Python3 on EPEL:
http://fedoraproject.org/wiki/PackagingDrafts:Python3EPEL
- Modernize the spec a bit (build and install macros, no explicit buildroot)
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.11-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild