Gentoo Archives: gentoo-commits

From: "Aaron W. Swenson" <titanofold@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/python-dateutil/files/, dev-python/python-dateutil/
Date: Thu, 17 Oct 2019 22:30:52
Message-Id: 1571351428.c10b4898dd8abacc49c747501e8b9929601723ad.titanofold@gentoo
1 commit: c10b4898dd8abacc49c747501e8b9929601723ad
2 Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 17 22:29:25 2019 +0000
4 Commit: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 17 22:30:28 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c10b4898
7
8 dev-python/python-dateutil: Patch fix, remove fbsd
9
10 Update patch so tests pass again.
11
12 Remove *-fbsd keywords again.
13
14 Bug: https://bugs.gentoo.org/679792
15 Closes: https://bugs.gentoo.org/695810
16 Package-Manager: Portage-2.3.76, Repoman-2.3.16
17 Signed-off-by: Aaron W. Swenson <titanofold <AT> gentoo.org>
18
19 ...o-Get-timezone-data-from-system-tzdata-r1.patch | 104 +++++++++++++++++++++
20 .../python-dateutil/python-dateutil-2.8.0.ebuild | 4 +-
21 2 files changed, 106 insertions(+), 2 deletions(-)
22
23 diff --git a/dev-python/python-dateutil/files/0001-zoneinfo-Get-timezone-data-from-system-tzdata-r1.patch b/dev-python/python-dateutil/files/0001-zoneinfo-Get-timezone-data-from-system-tzdata-r1.patch
24 new file mode 100644
25 index 00000000000..a937e6600a2
26 --- /dev/null
27 +++ b/dev-python/python-dateutil/files/0001-zoneinfo-Get-timezone-data-from-system-tzdata-r1.patch
28 @@ -0,0 +1,104 @@
29 +From f48e70ae846c161dfbfe6ddb36e4bcad4427ac8c Mon Sep 17 00:00:00 2001
30 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
31 +Date: Tue, 3 Apr 2018 22:03:32 +0200
32 +Subject: [PATCH] zoneinfo: Get timezone data from system tzdata
33 +
34 +---
35 + dateutil/test/test_imports.py | 3 +--
36 + dateutil/zoneinfo/__init__.py | 25 ++++++++++++++-----------
37 + 2 files changed, 15 insertions(+), 13 deletions(-)
38 +
39 +diff --git a/dateutil/test/test_imports.py b/dateutil/test/test_imports.py
40 +index 2a19b62..97d07e4 100644
41 +--- a/dateutil/test/test_imports.py
42 ++++ b/dateutil/test/test_imports.py
43 +@@ -158,9 +158,8 @@ class ImportZoneInfoTest(unittest.TestCase):
44 + def testZoneinfoStar(self):
45 + from dateutil.zoneinfo import gettz
46 + from dateutil.zoneinfo import gettz_db_metadata
47 +- from dateutil.zoneinfo import rebuild
48 +
49 +- zi_all = (gettz, gettz_db_metadata, rebuild)
50 ++ zi_all = (gettz, gettz_db_metadata)
51 +
52 + for var in zi_all:
53 + self.assertIsNot(var, None)
54 +diff --git a/dateutil/zoneinfo/__init__.py b/dateutil/zoneinfo/__init__.py
55 +index 34f11ad..e9870ca 100644
56 +--- a/dateutil/zoneinfo/__init__.py
57 ++++ b/dateutil/zoneinfo/__init__.py
58 +@@ -1,6 +1,7 @@
59 + # -*- coding: utf-8 -*-
60 + import warnings
61 + import json
62 ++import os
63 +
64 + from tarfile import TarFile
65 + from pkgutil import get_data
66 +@@ -10,7 +11,7 @@ from dateutil.tz import tzfile as _tzfile
67 +
68 + __all__ = ["get_zonefile_instance", "gettz", "gettz_db_metadata"]
69 +
70 +-ZONEFILENAME = "dateutil-zoneinfo.tar.gz"
71 ++ZONEDIRECTORY = "/usr/share/zoneinfo"
72 + METADATA_FN = 'METADATA'
73 +
74 +
75 +@@ -19,12 +20,14 @@ class tzfile(_tzfile):
76 + return (gettz, (self._filename,))
77 +
78 +
79 +-def getzoneinfofile_stream():
80 +- try:
81 +- return BytesIO(get_data(__name__, ZONEFILENAME))
82 +- except IOError as e: # TODO switch to FileNotFoundError?
83 +- warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))
84 +- return None
85 ++def iter_zones(topdir):
86 ++ for dirpath, dirnames, filenames in os.walk(topdir):
87 ++ for f in filenames:
88 ++ if f.endswith('.list') or f.endswith('.tab'):
89 ++ continue
90 ++ fpath = os.path.join(dirpath, f)
91 ++ relpath = os.path.relpath(fpath, topdir)
92 ++ yield (relpath, tzfile(fpath, filename=relpath))
93 +
94 +
95 + class ZoneInfoFile(object):
96 +@@ -48,7 +51,7 @@ class ZoneInfoFile(object):
97 + # no metadata in tar file
98 + self.metadata = None
99 + else:
100 +- self.zones = {}
101 ++ self.zones = dict(iter_zones(ZONEDIRECTORY))
102 + self.metadata = None
103 +
104 + def get(self, name, default=None):
105 +@@ -99,7 +102,7 @@ def get_zonefile_instance(new_instance=False):
106 + zif = getattr(get_zonefile_instance, '_cached_instance', None)
107 +
108 + if zif is None:
109 +- zif = ZoneInfoFile(getzoneinfofile_stream())
110 ++ zif = ZoneInfoFile()
111 +
112 + get_zonefile_instance._cached_instance = zif
113 +
114 +@@ -140,7 +143,7 @@ def gettz(name):
115 + DeprecationWarning)
116 +
117 + if len(_CLASS_ZONE_INSTANCE) == 0:
118 +- _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream()))
119 ++ _CLASS_ZONE_INSTANCE.append(ZoneInfoFile())
120 + return _CLASS_ZONE_INSTANCE[0].zones.get(name)
121 +
122 +
123 +@@ -163,5 +166,5 @@ def gettz_db_metadata():
124 + DeprecationWarning)
125 +
126 + if len(_CLASS_ZONE_INSTANCE) == 0:
127 +- _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream()))
128 ++ _CLASS_ZONE_INSTANCE.append(ZoneInfoFile())
129 + return _CLASS_ZONE_INSTANCE[0].metadata
130 +--
131 +2.17.0
132 +
133
134 diff --git a/dev-python/python-dateutil/python-dateutil-2.8.0.ebuild b/dev-python/python-dateutil/python-dateutil-2.8.0.ebuild
135 index 172252195d8..52b8a8decb7 100644
136 --- a/dev-python/python-dateutil/python-dateutil-2.8.0.ebuild
137 +++ b/dev-python/python-dateutil/python-dateutil-2.8.0.ebuild
138 @@ -17,7 +17,7 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
139
140 LICENSE="BSD"
141 SLOT="0"
142 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
143 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
144 IUSE="test"
145
146 RDEPEND="
147 @@ -36,7 +36,7 @@ DEPEND="${RDEPEND}
148
149 python_prepare_all() {
150 local PATCHES=(
151 - "${FILESDIR}"/0001-zoneinfo-Get-timezone-data-from-system-tzdata.patch
152 + "${FILESDIR}"/0001-zoneinfo-Get-timezone-data-from-system-tzdata-r1.patch
153 )
154
155 # don't install zoneinfo tarball