Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pytzdata/, dev-python/pytzdata/files/
Date: Fri, 09 Jul 2021 14:44:49
Message-Id: 1625841855.03b481085bc20e6c9ea57a15335054256eb33cb4.mgorny@gentoo
1 commit: 03b481085bc20e6c9ea57a15335054256eb33cb4
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 9 08:19:33 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 9 14:44:15 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03b48108
7
8 dev-python/pytzdata: Use system zoneinfo by default
9
10 Closes: https://bugs.gentoo.org/801280
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 .../files/pytzdata-2020.1-system-zoneinfo.patch | 115 +++++++++++++++++++++
14 ...ata-2020.1.ebuild => pytzdata-2020.1-r1.ebuild} | 9 +-
15 2 files changed, 121 insertions(+), 3 deletions(-)
16
17 diff --git a/dev-python/pytzdata/files/pytzdata-2020.1-system-zoneinfo.patch b/dev-python/pytzdata/files/pytzdata-2020.1-system-zoneinfo.patch
18 new file mode 100644
19 index 00000000000..7a4cced9e72
20 --- /dev/null
21 +++ b/dev-python/pytzdata/files/pytzdata-2020.1-system-zoneinfo.patch
22 @@ -0,0 +1,115 @@
23 +From f0d2c5fd28dbe2aa9ecb59e140ab42b11d677a33 Mon Sep 17 00:00:00 2001
24 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
25 +Date: Fri, 9 Jul 2021 10:15:51 +0200
26 +Subject: [PATCH] Use system zoneinfo database by default
27 +MIME-Version: 1.0
28 +Content-Type: text/plain; charset=UTF-8
29 +Content-Transfer-Encoding: 8bit
30 +
31 +Signed-off-by: Michał Górny <mgorny@g.o>
32 +---
33 + pytzdata/__init__.py | 2 +-
34 + tests/test_set_directory.py | 8 +++-----
35 + tests/test_tz_file.py | 5 ++---
36 + tests/test_tz_path.py | 5 ++---
37 + 4 files changed, 8 insertions(+), 12 deletions(-)
38 +
39 +diff --git a/pytzdata/__init__.py b/pytzdata/__init__.py
40 +index 22940da..6c3bcb9 100644
41 +--- a/pytzdata/__init__.py
42 ++++ b/pytzdata/__init__.py
43 +@@ -8,7 +8,7 @@ from ._compat import FileNotFoundError
44 +
45 +
46 + DEFAULT_DIRECTORY = os.path.join(
47 +- os.path.dirname(__file__),
48 ++ '/usr/share',
49 + 'zoneinfo'
50 + )
51 +
52 +diff --git a/tests/test_set_directory.py b/tests/test_set_directory.py
53 +index 430d239..6c078e6 100644
54 +--- a/tests/test_set_directory.py
55 ++++ b/tests/test_set_directory.py
56 +@@ -2,7 +2,7 @@
57 +
58 + import os
59 + import pytest
60 +-from pytzdata import set_directory, tz_path, TimezoneNotFound
61 ++from pytzdata import set_directory, tz_path, TimezoneNotFound, DEFAULT_DIRECTORY
62 +
63 +
64 + fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures', 'tz')
65 +@@ -30,9 +30,8 @@ def test_set_directory():
66 + with pytest.raises(TimezoneNotFound):
67 + tz_path('America/New_York')
68 +
69 +- here = os.path.realpath(os.path.dirname(__file__))
70 + filepath = os.path.realpath(
71 +- os.path.join(here, '..', 'pytzdata', 'zoneinfo', 'America', 'New_York')
72 ++ os.path.join(DEFAULT_DIRECTORY, 'America', 'New_York')
73 + )
74 +
75 + set_directory()
76 +@@ -51,9 +50,8 @@ def test_env_variable():
77 +
78 + del os.environ['PYTZDATA_TZDATADIR']
79 +
80 +- here = os.path.realpath(os.path.dirname(__file__))
81 + filepath = os.path.realpath(
82 +- os.path.join(here, '..', 'pytzdata', 'zoneinfo', 'America', 'New_York')
83 ++ os.path.join(DEFAULT_DIRECTORY, 'America', 'New_York')
84 + )
85 +
86 + set_directory()
87 +diff --git a/tests/test_tz_file.py b/tests/test_tz_file.py
88 +index 8b912b5..b20c08b 100644
89 +--- a/tests/test_tz_file.py
90 ++++ b/tests/test_tz_file.py
91 +@@ -3,7 +3,7 @@
92 + import os
93 + import pytest
94 +
95 +-from pytzdata import tz_file, set_directory
96 ++from pytzdata import tz_file, set_directory, DEFAULT_DIRECTORY
97 + from pytzdata.exceptions import TimezoneNotFound
98 +
99 +
100 +@@ -22,9 +22,8 @@ def teardown_module(module):
101 +
102 +
103 + def test_tz_file():
104 +- here = os.path.realpath(os.path.dirname(__file__))
105 + filepath = os.path.realpath(
106 +- os.path.join(here, '..', 'pytzdata', 'zoneinfo', 'Europe', 'Paris')
107 ++ os.path.join(DEFAULT_DIRECTORY, 'Europe', 'Paris')
108 + )
109 +
110 + with open(filepath) as f1:
111 +diff --git a/tests/test_tz_path.py b/tests/test_tz_path.py
112 +index fd4db48..77c8c74 100644
113 +--- a/tests/test_tz_path.py
114 ++++ b/tests/test_tz_path.py
115 +@@ -3,7 +3,7 @@
116 + import os
117 + import pytest
118 +
119 +-from pytzdata import tz_path, set_directory
120 ++from pytzdata import tz_path, set_directory, DEFAULT_DIRECTORY
121 + from pytzdata.exceptions import TimezoneNotFound
122 +
123 +
124 +@@ -22,9 +22,8 @@ def teardown_module(module):
125 +
126 +
127 + def test_tz_path():
128 +- here = os.path.realpath(os.path.dirname(__file__))
129 + filepath = os.path.realpath(
130 +- os.path.join(here, '..', 'pytzdata', 'zoneinfo', 'Europe', 'Paris')
131 ++ os.path.join(DEFAULT_DIRECTORY, 'Europe', 'Paris')
132 + )
133 +
134 + assert filepath == tz_path('Europe/Paris')
135 +--
136 +2.32.0
137 +
138
139 diff --git a/dev-python/pytzdata/pytzdata-2020.1.ebuild b/dev-python/pytzdata/pytzdata-2020.1-r1.ebuild
140 similarity index 81%
141 rename from dev-python/pytzdata/pytzdata-2020.1.ebuild
142 rename to dev-python/pytzdata/pytzdata-2020.1-r1.ebuild
143 index 1863e027767..d6192adb5e3 100644
144 --- a/dev-python/pytzdata/pytzdata-2020.1.ebuild
145 +++ b/dev-python/pytzdata/pytzdata-2020.1-r1.ebuild
146 @@ -1,10 +1,10 @@
147 # Copyright 2021 Gentoo Authors
148 # Distributed under the terms of the GNU General Public License v2
149
150 -EAPI=7
151 +EAPI=8
152
153 DISTUTILS_USE_SETUPTOOLS=pyproject.toml
154 -PYTHON_COMPAT=( python3_{7..10} )
155 +PYTHON_COMPAT=( python3_{8..10} )
156 inherit distutils-r1
157
158 DESCRIPTION="The Olson timezone database for Python"
159 @@ -16,6 +16,9 @@ SLOT="0"
160 KEYWORDS="amd64 x86"
161
162 RDEPEND="dev-python/cleo[${PYTHON_USEDEP}]"
163 -DEPEND="${RDEPEND}"
164
165 distutils_enable_tests pytest
166 +
167 +PATCHES=(
168 + "${FILESDIR}"/pytzdata-2020.1-system-zoneinfo.patch
169 +)