From e43e0a69943ff0663c0d62fae9d2e0fffc71e33ee768f8d5f9168bff19d00464 Mon Sep 17 00:00:00 2001 From: Jan Matejek Date: Tue, 14 Mar 2017 12:59:46 +0000 Subject: [PATCH] Accepting request 479121 from home:AndreasStieger:branches:devel:languages:python - re-add and fix system_zoneinfo.patch which was dropped in error boo#1029120 OBS-URL: https://build.opensuse.org/request/show/479121 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pytz?expand=0&rev=51 --- python-pytz.changes | 6 ++++++ python-pytz.spec | 6 ++++++ system_zoneinfo.patch | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 system_zoneinfo.patch diff --git a/python-pytz.changes b/python-pytz.changes index 1d3db83..3db1599 100644 --- a/python-pytz.changes +++ b/python-pytz.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Mar 13 18:08:26 UTC 2017 - astieger@suse.com + +- re-add and fix system_zoneinfo.patch which was dropped in error + boo#1029120 + ------------------------------------------------------------------- Thu Mar 2 16:39:42 UTC 2017 - astieger@suse.com diff --git a/python-pytz.spec b/python-pytz.spec index d95af39..3d0f100 100644 --- a/python-pytz.spec +++ b/python-pytz.spec @@ -29,6 +29,8 @@ Source2: https://files.pythonhosted.org/packages/source/p/pytz/pytz-%{ver Source90: pytz.keyring # PATCH-FIX-UPSTREAM fix-tests.patch -- Remote tests which are known to be broken Patch0: fix-tests.patch +# PATCH-FEATURE-OPENSUSE -- Use system tz database (Olson database) +Patch1: system_zoneinfo.patch Requires: timezone BuildRequires: %{python_module devel} BuildRequires: %{python_module nose} @@ -62,6 +64,10 @@ Amost all of the Olson timezones are supported. %setup -q -n pytz-%{version} # Disable test which is not working (and documented so) %patch0 -p1 +%if 0%{?suse_version} >= 1310 +# Use system tz database +%patch1 -p1 +%endif # For rpmlint warning: remove shebang from python library: sed -i '/^#!/d' ./pytz/tzfile.py diff --git a/system_zoneinfo.patch b/system_zoneinfo.patch new file mode 100644 index 0000000..4225e74 --- /dev/null +++ b/system_zoneinfo.patch @@ -0,0 +1,38 @@ +Index: pytz-2016.10/pytz/__init__.py +=================================================================== +--- pytz-2016.10.orig/pytz/__init__.py ++++ pytz-2016.10/pytz/__init__.py +@@ -81,19 +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): +- # http://bugs.launchpad.net/bugs/383171 - we avoid using this +- # unless absolutely necessary to help when a broken version of +- # pkg_resources is installed. +- try: +- from pkg_resources import resource_stream +- except ImportError: +- resource_stream = None +- +- if resource_stream is not None: +- return resource_stream(__name__, 'zoneinfo/' + name) ++ filename = os.path.join('/usr/share/zoneinfo', *name_parts) + return open(filename, 'rb') + + +Index: pytz-2016.10/pytz/tzfile.py +=================================================================== +--- pytz-2016.10.orig/pytz/tzfile.py ++++ pytz-2016.10/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',