From 060a8c2c5f82a628af6b678dd6f0508037130952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Wed, 23 Apr 2014 23:42:44 +0100
Subject: [PATCH] add python3 package
---
python-iso8601.spec | 71 +++++++++++++++++++++++++++++++++------------
1 file changed, 53 insertions(+), 18 deletions(-)
diff --git a/python-iso8601.spec b/python-iso8601.spec
index 6634344..eac1e0e 100644
--- a/python-iso8601.spec
+++ b/python-iso8601.spec
@@ -1,52 +1,87 @@
-%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%if 0%{?fedora}
+%global with_python3 1
%endif
-%global tarball_name iso8601
+%if 0%{?rhel} && 0%{?rhel} <= 6
+%{!?__python2: %global __python2 /usr/bin/python2}
+%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%endif
-Name: python-iso8601
+%global srcname iso8601
+
+Name: python-%{srcname}
Version: 0.1.10
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Simple module to parse ISO 8601 dates
Group: Development/Languages
License: MIT
-URL: http://pypi.python.org/pypi/iso8601/
-Source0: http://pypi.python.org/packages/source/i/iso8601/%{tarball_name}-%{version}.tar.gz
+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: python2-devel python-setuptools
+%if 0%{?with_python3}
+BuildRequires: python3-devel python3-setuptools
+%endif
%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.
+This module parses the most common forms of ISO 8601 date strings
+(e.g. 2007-01-14T20:34:22+00:00) into datetime objects.
+%if 0%{?with_python3}
+%package -n python3-%{srcname}
+Summary: Simple module to parse ISO 8601 dates
+Group: Development/Languages
+
+%description -n python3-%{srcname}
+This module parses the most common forms of ISO 8601 date strings
+(e.g. 2007-01-14T20:34:22+00:00) into datetime objects.
+%endif
%prep
-%setup -qn %{tarball_name}-%{version}
+%setup -qn %{srcname}-%{version}
+
+%if 0%{?with_python3}
+cp -a . %{py3dir}
+%endif
%build
-%{__python} setup.py build
+%{__python2} setup.py build
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif
%install
-rm -rf %{buildroot}
-%{__python} setup.py install -O1 --skip-build --root %{buildroot}
-
-
-%clean
-rm -rf %{buildroot}
+%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --root %{buildroot}
+popd
+%endif
%files
%defattr(-,root,root,-)
%doc LICENSE README.rst
-%{python_sitelib}/*
+%{python2_sitelib}/*
+%if 0%{?with_python3}
+%files -n python3-%{srcname}
+%defattr(-,root,root,-)
+%doc LICENSE README.rst
+%{python3_sitelib}/*
+%endif
%changelog
+* Wed Apr 23 2014 Pádraig Brady