1 |
commit: 00c5b3e761a5dee7eb73133667fc053c9365fc6f |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jul 15 04:27:51 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jul 15 09:22:20 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00c5b3e7 |
7 |
|
8 |
dev-python/python-dateutil: Bump to 2.8.2 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/python-dateutil/Manifest | 1 + |
13 |
.../python-dateutil-2.8.2-system-tzdata.patch | 104 +++++++++++++++++++++ |
14 |
.../python-dateutil/python-dateutil-2.8.2.ebuild | 45 +++++++++ |
15 |
3 files changed, 150 insertions(+) |
16 |
|
17 |
diff --git a/dev-python/python-dateutil/Manifest b/dev-python/python-dateutil/Manifest |
18 |
index 9eb681136f6..8781f6a62fc 100644 |
19 |
--- a/dev-python/python-dateutil/Manifest |
20 |
+++ b/dev-python/python-dateutil/Manifest |
21 |
@@ -1 +1,2 @@ |
22 |
DIST python-dateutil-2.8.1.tar.gz 331745 BLAKE2B 9785fe93976d9bbe21d6610133e37e558cdde4062a1a738ccbf2bf80aa062882ba59c60f2b9bfc44c53e0f8fc4b5ebdd5d12b6ba54a60706576360e453b2f160 SHA512 337000216e0f8ce32d6363768444144183ab9268f69082f20858f2b3322b1c449e53b2f2b5dcb3645be22294659ce7838f74ace2fd7a7c4f2adc6cf806a9fa2c |
23 |
+DIST python-dateutil-2.8.2.tar.gz 357324 BLAKE2B 060f97280b63ed70e6d83fa5696af6dc3c729cdf5bc48c7a90e3e59eb0cc0360e5205536685550330d64ecc9b6e40ca12888409d6819dd136b17a67add2ec4e8 SHA512 6538858e4a3e2d1de1bf25b6d8b25e3a8d20bf60fb85e32d07ac491c90ce193e268bb5641371b8a79fb0f033a184bac9896b3bc643c1aca9ee9c6478286ac20c |
24 |
|
25 |
diff --git a/dev-python/python-dateutil/files/python-dateutil-2.8.2-system-tzdata.patch b/dev-python/python-dateutil/files/python-dateutil-2.8.2-system-tzdata.patch |
26 |
new file mode 100644 |
27 |
index 00000000000..3790a29b421 |
28 |
--- /dev/null |
29 |
+++ b/dev-python/python-dateutil/files/python-dateutil-2.8.2-system-tzdata.patch |
30 |
@@ -0,0 +1,104 @@ |
31 |
+From 907459c6f632a87fce5729f6eebd2adf5b94e577 Mon Sep 17 00:00:00 2001 |
32 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
33 |
+Date: Tue, 3 Apr 2018 22:03:32 +0200 |
34 |
+Subject: [PATCH] zoneinfo: Get timezone data from system tzdata |
35 |
+ |
36 |
+--- |
37 |
+ dateutil/test/test_imports.py | 3 +-- |
38 |
+ dateutil/zoneinfo/__init__.py | 25 ++++++++++++++----------- |
39 |
+ 2 files changed, 15 insertions(+), 13 deletions(-) |
40 |
+ |
41 |
+diff --git a/dateutil/test/test_imports.py b/dateutil/test/test_imports.py |
42 |
+index 60b8600..b9f517c 100644 |
43 |
+--- a/dateutil/test/test_imports.py |
44 |
++++ b/dateutil/test/test_imports.py |
45 |
+@@ -168,9 +168,8 @@ def test_import_zone_info_from(): |
46 |
+ def test_import_zone_info_star(): |
47 |
+ from dateutil.zoneinfo import gettz |
48 |
+ from dateutil.zoneinfo import gettz_db_metadata |
49 |
+- from dateutil.zoneinfo import rebuild |
50 |
+ |
51 |
+- zi_all = (gettz, gettz_db_metadata, rebuild) |
52 |
++ zi_all = (gettz, gettz_db_metadata) |
53 |
+ |
54 |
+ for var in zi_all: |
55 |
+ assert var is not None |
56 |
+diff --git a/dateutil/zoneinfo/__init__.py b/dateutil/zoneinfo/__init__.py |
57 |
+index 34f11ad..e3f0f94 100644 |
58 |
+--- a/dateutil/zoneinfo/__init__.py |
59 |
++++ b/dateutil/zoneinfo/__init__.py |
60 |
+@@ -1,6 +1,7 @@ |
61 |
+ # -*- coding: utf-8 -*- |
62 |
+ import warnings |
63 |
+ import json |
64 |
++import os |
65 |
+ |
66 |
+ from tarfile import TarFile |
67 |
+ from pkgutil import get_data |
68 |
+@@ -10,7 +11,7 @@ from dateutil.tz import tzfile as _tzfile |
69 |
+ |
70 |
+ __all__ = ["get_zonefile_instance", "gettz", "gettz_db_metadata"] |
71 |
+ |
72 |
+-ZONEFILENAME = "dateutil-zoneinfo.tar.gz" |
73 |
++ZONEDIRECTORY = "/usr/share/zoneinfo" |
74 |
+ METADATA_FN = 'METADATA' |
75 |
+ |
76 |
+ |
77 |
+@@ -19,12 +20,14 @@ class tzfile(_tzfile): |
78 |
+ return (gettz, (self._filename,)) |
79 |
+ |
80 |
+ |
81 |
+-def getzoneinfofile_stream(): |
82 |
+- try: |
83 |
+- return BytesIO(get_data(__name__, ZONEFILENAME)) |
84 |
+- except IOError as e: # TODO switch to FileNotFoundError? |
85 |
+- warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror)) |
86 |
+- return None |
87 |
++def iter_zones(topdir): |
88 |
++ for dirpath, dirnames, filenames in os.walk(topdir): |
89 |
++ for f in filenames: |
90 |
++ if f.endswith(('.list', '.tab', '.zi', 'leapseconds')): |
91 |
++ continue |
92 |
++ fpath = os.path.join(dirpath, f) |
93 |
++ relpath = os.path.relpath(fpath, topdir) |
94 |
++ yield (relpath, tzfile(fpath, filename=relpath)) |
95 |
+ |
96 |
+ |
97 |
+ class ZoneInfoFile(object): |
98 |
+@@ -48,7 +51,7 @@ class ZoneInfoFile(object): |
99 |
+ # no metadata in tar file |
100 |
+ self.metadata = None |
101 |
+ else: |
102 |
+- self.zones = {} |
103 |
++ self.zones = dict(iter_zones(ZONEDIRECTORY)) |
104 |
+ self.metadata = None |
105 |
+ |
106 |
+ def get(self, name, default=None): |
107 |
+@@ -99,7 +102,7 @@ def get_zonefile_instance(new_instance=False): |
108 |
+ zif = getattr(get_zonefile_instance, '_cached_instance', None) |
109 |
+ |
110 |
+ if zif is None: |
111 |
+- zif = ZoneInfoFile(getzoneinfofile_stream()) |
112 |
++ zif = ZoneInfoFile() |
113 |
+ |
114 |
+ get_zonefile_instance._cached_instance = zif |
115 |
+ |
116 |
+@@ -140,7 +143,7 @@ def gettz(name): |
117 |
+ DeprecationWarning) |
118 |
+ |
119 |
+ if len(_CLASS_ZONE_INSTANCE) == 0: |
120 |
+- _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream())) |
121 |
++ _CLASS_ZONE_INSTANCE.append(ZoneInfoFile()) |
122 |
+ return _CLASS_ZONE_INSTANCE[0].zones.get(name) |
123 |
+ |
124 |
+ |
125 |
+@@ -163,5 +166,5 @@ def gettz_db_metadata(): |
126 |
+ DeprecationWarning) |
127 |
+ |
128 |
+ if len(_CLASS_ZONE_INSTANCE) == 0: |
129 |
+- _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream())) |
130 |
++ _CLASS_ZONE_INSTANCE.append(ZoneInfoFile()) |
131 |
+ return _CLASS_ZONE_INSTANCE[0].metadata |
132 |
+-- |
133 |
+2.32.0 |
134 |
+ |
135 |
|
136 |
diff --git a/dev-python/python-dateutil/python-dateutil-2.8.2.ebuild b/dev-python/python-dateutil/python-dateutil-2.8.2.ebuild |
137 |
new file mode 100644 |
138 |
index 00000000000..3ef5ec777d0 |
139 |
--- /dev/null |
140 |
+++ b/dev-python/python-dateutil/python-dateutil-2.8.2.ebuild |
141 |
@@ -0,0 +1,45 @@ |
142 |
+# Copyright 1999-2021 Gentoo Authors |
143 |
+# Distributed under the terms of the GNU General Public License v2 |
144 |
+ |
145 |
+EAPI=8 |
146 |
+ |
147 |
+PYTHON_COMPAT=( python3_{8..10} pypy3 ) |
148 |
+inherit distutils-r1 |
149 |
+ |
150 |
+DESCRIPTION="Extensions to the standard Python datetime module" |
151 |
+HOMEPAGE=" |
152 |
+ https://dateutil.readthedocs.io/ |
153 |
+ https://pypi.org/project/python-dateutil/ |
154 |
+ https://github.com/dateutil/dateutil/ |
155 |
+" |
156 |
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" |
157 |
+ |
158 |
+LICENSE="BSD" |
159 |
+SLOT="0" |
160 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" |
161 |
+ |
162 |
+RDEPEND=" |
163 |
+ >=dev-python/six-1.5[${PYTHON_USEDEP}] |
164 |
+ sys-libs/timezone-data |
165 |
+" |
166 |
+BDEPEND=" |
167 |
+ dev-python/setuptools_scm[${PYTHON_USEDEP}] |
168 |
+ test? ( |
169 |
+ dev-python/freezegun[${PYTHON_USEDEP}] |
170 |
+ dev-python/hypothesis[${PYTHON_USEDEP}] |
171 |
+ ) |
172 |
+" |
173 |
+ |
174 |
+PATCHES=( |
175 |
+ "${FILESDIR}/python-dateutil-2.8.2-system-tzdata.patch" |
176 |
+ "${FILESDIR}/python-dateutil-2.8.1-no-pytest-cov.patch" |
177 |
+) |
178 |
+ |
179 |
+distutils_enable_tests pytest |
180 |
+ |
181 |
+python_prepare_all() { |
182 |
+ # don't install zoneinfo tarball |
183 |
+ sed -i '/package_data=/d' setup.py || die |
184 |
+ |
185 |
+ distutils-r1_python_prepare_all |
186 |
+} |