Accepting request 261436 from home:aplanas:branches:devel:languages:python
Use the system tz database. OBS-URL: https://build.opensuse.org/request/show/261436 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pytz?expand=0&rev=27
This commit is contained in:
parent
2cf039ee1d
commit
deee7ff03d
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Nov 13 12:17:35 UTC 2014 - aplanas@suse.com
|
||||||
|
|
||||||
|
- Use system tz database instead pytz one
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Nov 11 11:47:38 UTC 2014 - idonmez@suse.com
|
Tue Nov 11 11:47:38 UTC 2014 - idonmez@suse.com
|
||||||
|
|
||||||
|
@ -26,9 +26,14 @@ Url: http://pytz.sourceforge.net
|
|||||||
Source: http://pypi.python.org/packages/source/p/pytz/pytz-%{version}.tar.bz2
|
Source: http://pypi.python.org/packages/source/p/pytz/pytz-%{version}.tar.bz2
|
||||||
# PATCH-FIX-UPSTREAM fix-tests.patch -- Remote tests which are known to be broken
|
# PATCH-FIX-UPSTREAM fix-tests.patch -- Remote tests which are known to be broken
|
||||||
Patch0: fix-tests.patch
|
Patch0: fix-tests.patch
|
||||||
|
# PATCH-FEATURE-OPENSUSE -- Use system tz database (Olson database)
|
||||||
|
Patch1: system_zoneinfo.patch
|
||||||
|
Requires: timezone
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
BuildRequires: python-nose
|
BuildRequires: python-nose
|
||||||
|
# Tests will use this package
|
||||||
|
BuildRequires: timezone
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
|
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
|
||||||
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||||
@ -53,6 +58,8 @@ Amost all of the Olson timezones are supported.
|
|||||||
%setup -q -n pytz-%{version}
|
%setup -q -n pytz-%{version}
|
||||||
# Disable test which is not working (and documented so)
|
# Disable test which is not working (and documented so)
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
# Use system tz database
|
||||||
|
%patch1 -p1
|
||||||
# For rpmlint warning: remove shebang from python library:
|
# For rpmlint warning: remove shebang from python library:
|
||||||
sed -i '/^#!/d' ./pytz/tzfile.py
|
sed -i '/^#!/d' ./pytz/tzfile.py
|
||||||
|
|
||||||
@ -61,6 +68,8 @@ python setup.py build
|
|||||||
|
|
||||||
%install
|
%install
|
||||||
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
||||||
|
# Remove the pytz zoneinfo
|
||||||
|
rm -fr %{buildroot}%{python_sitelib}/pytz/zoneinfo
|
||||||
%fdupes %{buildroot}%{python_sitelib}
|
%fdupes %{buildroot}%{python_sitelib}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
|
44
system_zoneinfo.patch
Normal file
44
system_zoneinfo.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
Index: pytz-2014.9/pytz/__init__.py
|
||||||
|
===================================================================
|
||||||
|
--- pytz-2014.9.orig/pytz/__init__.py
|
||||||
|
+++ pytz-2014.9/pytz/__init__.py
|
||||||
|
@@ -25,11 +25,6 @@ __all__ = [
|
||||||
|
|
||||||
|
import sys, datetime, os.path, gettext
|
||||||
|
|
||||||
|
-try:
|
||||||
|
- from pkg_resources import resource_stream
|
||||||
|
-except ImportError:
|
||||||
|
- resource_stream = None
|
||||||
|
-
|
||||||
|
from pytz.exceptions import AmbiguousTimeError
|
||||||
|
from pytz.exceptions import InvalidTimeError
|
||||||
|
from pytz.exceptions import NonExistentTimeError
|
||||||
|
@@ -86,13 +81,7 @@ def open_resource(name):
|
||||||
|
for part in name_parts:
|
||||||
|
if part == os.path.pardir or os.path.sep in part:
|
||||||
|
raise ValueError('Bad path segment: %r' % part)
|
||||||
|
- filename = os.path.join(os.path.dirname(__file__),
|
||||||
|
- 'zoneinfo', *name_parts)
|
||||||
|
- if not os.path.exists(filename) and resource_stream is not None:
|
||||||
|
- # http://bugs.launchpad.net/bugs/383171 - we avoid using this
|
||||||
|
- # unless absolutely necessary to help when a broken version of
|
||||||
|
- # pkg_resources is installed.
|
||||||
|
- return resource_stream(__name__, 'zoneinfo/' + name)
|
||||||
|
+ filename = os.path.join('/usr/share/zoneinfo', *name_parts)
|
||||||
|
return open(filename, 'rb')
|
||||||
|
|
||||||
|
|
||||||
|
Index: pytz-2014.9/pytz/tzfile.py
|
||||||
|
===================================================================
|
||||||
|
--- pytz-2014.9.orig/pytz/tzfile.py
|
||||||
|
+++ pytz-2014.9/pytz/tzfile.py
|
||||||
|
@@ -127,7 +127,7 @@ def build_tzinfo(zone, fp):
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import os.path
|
||||||
|
from pprint import pprint
|
||||||
|
- base = os.path.join(os.path.dirname(__file__), 'zoneinfo')
|
||||||
|
+ base = '/usr/share/zoneinfo'
|
||||||
|
tz = build_tzinfo('Australia/Melbourne',
|
||||||
|
open(os.path.join(base,'Australia','Melbourne'), 'rb'))
|
||||||
|
tz = build_tzinfo('US/Eastern',
|
Loading…
Reference in New Issue
Block a user