archrelease: copy trunk to community-any
[ArchLinux/community.git] / python-pytz / repos / community-any / 0001-Use-the-system-zoneinfo-from-the-tzdata-package.patch
blobba7e388fa5a6b630a0a6f21509f8d0aaf684e820
1 From 74baf31e5505d03a71df49894d57e1011e771eb9 Mon Sep 17 00:00:00 2001
2 From: Eli Schwartz <eschwartz@archlinux.org>
3 Date: Mon, 4 May 2020 15:26:01 -0400
4 Subject: [PATCH] Use the system zoneinfo from the tzdata package.
6 We don't need to ship these vendored blobs as our system copy works
7 quite well.
9 Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
10 ---
11 src/pytz/__init__.py | 13 +------------
12 src/pytz/tzfile.py | 2 +-
13 src/setup.py | 2 --
14 3 files changed, 2 insertions(+), 15 deletions(-)
16 diff --git a/src/pytz/__init__.py b/src/pytz/__init__.py
17 index c25a1d1..3cc59ef 100644
18 --- a/src/pytz/__init__.py
19 +++ b/src/pytz/__init__.py
20 @@ -92,19 +92,8 @@ def open_resource(name):
21 if zoneinfo_dir is not None:
22 filename = os.path.join(zoneinfo_dir, *name_parts)
23 else:
24 - filename = os.path.join(os.path.dirname(__file__),
25 + filename = os.path.join('/usr', 'share',
26 'zoneinfo', *name_parts)
27 - if not os.path.exists(filename):
28 - # http://bugs.launchpad.net/bugs/383171 - we avoid using this
29 - # unless absolutely necessary to help when a broken version of
30 - # pkg_resources is installed.
31 - try:
32 - from pkg_resources import resource_stream
33 - except ImportError:
34 - resource_stream = None
36 - if resource_stream is not None:
37 - return resource_stream(__name__, 'zoneinfo/' + name)
38 return open(filename, 'rb')
41 diff --git a/src/pytz/tzfile.py b/src/pytz/tzfile.py
42 index 25117f3..98eba05 100644
43 --- a/src/pytz/tzfile.py
44 +++ b/src/pytz/tzfile.py
45 @@ -126,7 +126,7 @@ def build_tzinfo(zone, fp):
46 if __name__ == '__main__':
47 import os.path
48 from pprint import pprint
49 - base = os.path.join(os.path.dirname(__file__), 'zoneinfo')
50 + base = os.path.join('/usr', 'share', 'zoneinfo')
51 tz = build_tzinfo('Australia/Melbourne',
52 open(os.path.join(base, 'Australia', 'Melbourne'), 'rb'))
53 tz = build_tzinfo('US/Eastern',
54 diff --git a/src/setup.py b/src/setup.py
55 index fa9a592..675618c 100644
56 --- a/src/setup.py
57 +++ b/src/setup.py
58 @@ -22,8 +22,6 @@ for dirpath, dirnames, filenames in os.walk(os.path.join('pytz', 'zoneinfo')):
59 for filename in filenames])
60 package_data = {'pytz': resources}
62 -assert len(resources) > 10, 'zoneinfo files not found!'
64 setup(
65 name='pytz',
66 version=pytz.VERSION,
67 --
68 2.26.2