pytz: upgraded package to upstream
Upgraded dev-python/pytz to version 2024.1.
BUG=b:318531403
TEST=CQ
Change-Id: I7e22ea9afdd01112635d4b744a47088c381e9bf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/5420480
Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Auto-Submit: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Sergey Frolov <sfrolov@google.com>
diff --git a/dev-python/pytz/Manifest b/dev-python/pytz/Manifest
index 4e5cc66..6bc7f0a 100644
--- a/dev-python/pytz/Manifest
+++ b/dev-python/pytz/Manifest
@@ -1 +1 @@
-DIST pytz-2018.4.tar.gz 308066 BLAKE2B 665cebc5b535aafc92a1858b718d22818810534d8680a82ef3a0b66e6092f24226c36eb74feb690e25578b4d6ab8288cc4825eb5fb793345e11b0e71c6041868 SHA512 8a15e64d0d1a4b75c1e92360b22c06a41a692fe54fc8bfcff8cfa671095232d87f7929240441cd4d46826cd13f21d348125509c899be5a0b19bc7a77fdcb43c1
+DIST pytz-2024.1.tar.gz 316214 BLAKE2B 1047e11c41d3abeb10cdf55021c8702fbbb0c0dbcafc63c8c044ecf73dda2ac9344fc66e0a239302a0fd12856bbb3a7d49745eae671fac35db9c83fa502e7cf8 SHA512 cc1e4c9b34c62791cea277a0ce188d975e62135cb15bccfb49dc1a9366c7697ead9c67956846699f18b90db4c66e6c5fe1a91a524d01ae821c0eaa613550ea74
diff --git a/dev-python/pytz/files/2018.4-zoneinfo.patch b/dev-python/pytz/files/2018.4-zoneinfo.patch
deleted file mode 100644
index 2eeeab4..0000000
--- a/dev-python/pytz/files/2018.4-zoneinfo.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/pytz/__init__.py
-+++ b/pytz/__init__.py
-@@ -91,8 +91,7 @@
- if zoneinfo_dir is not None:
- filename = os.path.join(zoneinfo_dir, *name_parts)
- else:
-- filename = os.path.join(os.path.dirname(__file__),
-- 'zoneinfo', *name_parts)
-+ filename = os.path.join('/usr/share/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
diff --git a/dev-python/pytz/files/pytz-2018.4-zoneinfo-noinstall.patch b/dev-python/pytz/files/pytz-2018.4-zoneinfo-noinstall.patch
deleted file mode 100644
index 9f8b93b..0000000
--- a/dev-python/pytz/files/pytz-2018.4-zoneinfo-noinstall.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/setup.py
-+++ b/setup.py
-@@ -15,15 +15,8 @@
- memail = 'stuart@stuartbishop.net'
- packages = ['pytz']
- resources = ['zone.tab', 'locales/pytz.pot']
--for dirpath, dirnames, filenames in os.walk(os.path.join('pytz', 'zoneinfo')):
-- # remove the 'pytz' part of the path
-- basepath = dirpath.split(os.path.sep, 1)[1]
-- resources.extend([os.path.join(basepath, filename)
-- for filename in filenames])
- package_data = {'pytz': resources}
-
--assert len(resources) > 10, 'zoneinfo files not found!'
--
- setup(
- name='pytz',
- version=pytz.VERSION,
diff --git a/dev-python/pytz/files/pytz-2023.2-system-tzinfo.patch b/dev-python/pytz/files/pytz-2023.2-system-tzinfo.patch
new file mode 100644
index 0000000..85b639f
--- /dev/null
+++ b/dev-python/pytz/files/pytz-2023.2-system-tzinfo.patch
@@ -0,0 +1,52 @@
+Inspired by the Fedora patch:
+https://src.fedoraproject.org/rpms/pytz/blob/rawhide/f/pytz-zoneinfo.patch
+
+_allzones() is based on code in gen_tzinfo.py in upstream repo.
+
+diff --git a/pytz/__init__.py b/pytz/__init__.py
+index f89d0eb..d00f3bb 100644
+--- a/pytz/__init__.py
++++ b/pytz/__init__.py
+@@ -75,6 +75,21 @@ else: # Python 2.x
+ return s.encode('ASCII')
+
+
++def _allzones():
++ for dirpath, dirnames, filenames in os.walk(_PYTZ_TZDATADIR):
++ for f in filenames:
++ p = os.path.join(dirpath, f)
++ with open(p, 'rb') as tzfile:
++ if tzfile.read(4) == b'TZif':
++ yield os.path.relpath(p, _PYTZ_TZDATADIR)
++
++
++_PYTZ_TZDATADIR = os.environ.get('PYTZ_TZDATADIR', '/usr/share/zoneinfo')
++_all_timezones_unchecked = LazyList(x for x in _allzones())
++all_timezones = _all_timezones_unchecked
++all_timezones_set = LazySet(all_timezones)
++
++
+ def open_resource(name):
+ """Open a resource from the zoneinfo subdir for reading.
+
+@@ -88,7 +102,7 @@ def open_resource(name):
+ for part in name_parts:
+ if part == os.path.pardir or os.sep in part:
+ raise ValueError('Bad path segment: %r' % part)
+- zoneinfo_dir = os.environ.get('PYTZ_TZDATADIR', None)
++ zoneinfo_dir = _PYTZ_TZDATADIR
+ if zoneinfo_dir is not None:
+ filename = os.path.join(zoneinfo_dir, *name_parts)
+ else:
+diff --git a/setup.py b/setup.py
+index 24f7f37..b03592c 100644
+--- a/setup.py
++++ b/setup.py
+@@ -21,7 +21,6 @@ for dirpath, dirnames, filenames in os.walk(os.path.join('pytz', 'zoneinfo')):
+ resources.extend([os.path.join(basepath, filename) for filename in filenames])
+ package_data = {'pytz': resources}
+
+-assert len(resources) > 10, 'zoneinfo files not found!'
+
+ setup(
+ name='pytz',
diff --git a/dev-python/pytz/metadata.xml b/dev-python/pytz/metadata.xml
index 5e60478..59ff800 100644
--- a/dev-python/pytz/metadata.xml
+++ b/dev-python/pytz/metadata.xml
@@ -15,7 +15,7 @@
</longdescription>
<stabilize-allarches/>
<upstream>
+ <remote-id type="github">stub42/pytz</remote-id>
<remote-id type="pypi">pytz</remote-id>
- <remote-id type="launchpad">pytz</remote-id>
</upstream>
</pkgmetadata>
diff --git a/dev-python/pytz/pytz-2018.4.ebuild b/dev-python/pytz/pytz-2018.4.ebuild
deleted file mode 100644
index 0535c3f..0000000
--- a/dev-python/pytz/pytz-2018.4.ebuild
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python3_{6..9} pypy3 )
-PYTHON_REQ_USE="threads(+)"
-
-inherit distutils-r1
-
-DESCRIPTION="World timezone definitions for Python"
-HOMEPAGE="https://pythonhosted.org/pytz/ https://pypi.org/project/pytz/"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="*"
-IUSE=""
-
-RDEPEND="
- dev-python/setuptools[${PYTHON_USEDEP}]
- || ( >=sys-libs/timezone-data-2017a sys-libs/glibc[vanilla] )"
-DEPEND="${RDEPEND}
- app-arch/unzip"
-
-PATCHES=(
- # Use timezone-data zoneinfo.
- "${FILESDIR}"/2018.4-zoneinfo.patch
- # ...and do not install a copy of it.
- "${FILESDIR}"/${PN}-2018.4-zoneinfo-noinstall.patch
-)
-
-python_test() {
- "${PYTHON}" pytz/tests/test_tzinfo.py -v || die "Tests fail with ${EPYTHON}"
-}
diff --git a/dev-python/pytz/pytz-2024.1.ebuild b/dev-python/pytz/pytz-2024.1.ebuild
new file mode 100644
index 0000000..2955ab0
--- /dev/null
+++ b/dev-python/pytz/pytz-2024.1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..12} )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="World timezone definitions for Python"
+HOMEPAGE="
+ https://pythonhosted.org/pytz/
+ https://github.com/stub42/pytz/
+ https://pypi.org/project/pytz/
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="*"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ || (
+ >=sys-libs/timezone-data-2023b
+ sys-libs/glibc[vanilla]
+ )
+"
+BDEPEND="
+ test? (
+ ${RDEPEND}
+ )
+"
+
+src_prepare() {
+ distutils-r1_src_prepare
+
+ # unbundle timezone-data
+ rm -r pytz/zoneinfo || die
+ # remove hardcoded list of all timezones but leave subjective set
+ # of "common timezones"
+ sed -i -e '/^_all_timezones_unchecked/,/^all_timezones_set/d' pytz/__init__.py || die
+ eapply "${FILESDIR}"/pytz-2023.2-system-tzinfo.patch
+}
+
+python_test() {
+ "${EPYTHON}" pytz/tests/test_tzinfo.py -v ||
+ die "Tests fail with ${EPYTHON}"
+}