From 790efc91af248603dd6ecbb7b675eb7d0d33e00b Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Thu, 23 Aug 2012 09:51:08 -0500 Subject: [PATCH] Python 3 support, latest upstream. --- .gitignore | 1 + pytz.spec | 67 ++++++++++++++++++++++++++++++++++++++++++++++-------- sources | 2 +- 3 files changed, 59 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 8343e0d..95b6a56 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ pytz-2010h.tar.gz +/pytz-2012d.tar.gz diff --git a/pytz.spec b/pytz.spec index 8361d35..dbd6e7d 100644 --- a/pytz.spec +++ b/pytz.spec @@ -1,10 +1,12 @@ -%if 0%{?fedora} < 13 || 0%{?rhel} < 6 +%if 0%{?fedora} > 12 || 0%{?rhel} > 6 +%global with_python3 1 +%else %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %endif Name: pytz -Version: 2010h -Release: 6%{?dist} +Version: 2012d +Release: 1%{?dist} Summary: World Timezone Definitions for Python Group: Development/Languages @@ -12,11 +14,14 @@ License: MIT URL: http://pytz.sourceforge.net/ Source0: http://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz -Patch0: pytz-2010h_zoneinfo.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -BuildRequires: python-devel +BuildRequires: python2-devel + +%if 0%{?with_python3} +BuildRequires: python3-devel +%endif Requires: tzdata @@ -29,19 +34,50 @@ which you can read more about in the Python Library Reference Amost all (over 540) of the Olson timezones are supported. +%if 0%{?with_python3} +%package -n python3-%{name} +Requires: python3 +Summary: World Timezone Definitions for Python + +Group: Development/Languages +%description -n python3-%{name} +pytz brings the Olson tz database into Python. This library allows accurate +and cross platform timezone calculations using Python 2.3 or higher. It +also solves the issue of ambiguous times at the end of daylight savings, +which you can read more about in the Python Library Reference +(datetime.tzinfo). + +Amost all (over 540) of the Olson timezones are supported. +%endif + %prep %setup -q -%patch0 -p1 + +%if 0%{?with_python3} +cp -a . %{py3dir} +%endif %build %{__python} setup.py build +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif # with_python3 + %install -rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT -chmod +x $RPM_BUILD_ROOT%{python_sitelib}/pytz/*.py -rm -rf $RPM_BUILD_ROOT%{python_sitelib}/pytz/zoneinfo +%{__python} setup.py install --skip-build --root %{buildroot} +chmod +x %{buildroot}%{python_sitelib}/pytz/*.py +rm -rf %{buildroot}%{python_sitelib}/pytz/zoneinfo + +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root %{buildroot} +popd +%endif # with_python3 + %clean rm -rf $RPM_BUILD_ROOT @@ -53,7 +89,18 @@ rm -rf $RPM_BUILD_ROOT %{python_sitelib}/pytz/ %{python_sitelib}/*.egg-info +%if 0%{?with_python3} +%files -n python3-pytz +%doc CHANGES.txt LICENSE.txt README.txt +%{python3_sitelib}/pytz/ +%{python3_sitelib}/*.egg-info +%endif # with_python3 + + %changelog +* Thu Aug 23 2012 Jon Ciesla - 2012d-1 +- Latest upstream, python3 support, BZ 851226. + * Sat Jul 21 2012 Fedora Release Engineering - 2010h-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild diff --git a/sources b/sources index 26686d0..3541398 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -82f3b89fbe7b912542235963a8362e15 pytz-2010h.tar.gz +bf01c4fc9b64b164c3e2bb9c5477a544 pytz-2012d.tar.gz