From 2b9be53f918c4033671f4b5b7c9bc32781d1a436 Mon Sep 17 00:00:00 2001 From: "Andreas Billmeier (on testbox)" Date: Sun, 17 Mar 2019 23:10:52 +0100 Subject: [PATCH] repl python-dateutil-2.8.0 --- dev-python/python-dateutil/Manifest | 5 +- ...Get-timezone-data-from-system-tzdata.patch | 104 ++++++++++++++++++ dev-python/python-dateutil/metadata.xml | 19 ++-- .../python-dateutil-2.8.0.ebuild | 48 +++++--- 4 files changed, 151 insertions(+), 25 deletions(-) create mode 100644 dev-python/python-dateutil/files/0001-zoneinfo-Get-timezone-data-from-system-tzdata.patch diff --git a/dev-python/python-dateutil/Manifest b/dev-python/python-dateutil/Manifest index bcee6ef1e..b24858f4a 100644 --- a/dev-python/python-dateutil/Manifest +++ b/dev-python/python-dateutil/Manifest @@ -1,3 +1,4 @@ +AUX 0001-zoneinfo-Get-timezone-data-from-system-tzdata.patch 3504 BLAKE2B b26810c285257c14eec697e7529c3a85c637619dc19979a48b16b0ce45780041e84946748b30b048de84f5b35bb320dd7f79a22a13f42954433ad7ec7f3286a4 SHA512 37ad4c6630b0055a57704b375e6fa869c87a16b0d5d6c79bf77dd5cdfd7aeac56ad696e5a8acc5028b34dec35b932fa76e9fa8b26095cd369508af3386d3f89c DIST python-dateutil-2.8.0.tar.gz 327134 BLAKE2B 6525eee57aeaef3c588413210df7c1ad3627a380c6e44af78e9acc9abea523b29e8d9afec495f8d1e585d25d32ab82e6e28bf93dca148893d2e6a533e1f4ce47 SHA512 ec7da86203572582f883a4686acf8a732a2de4f396d809057eb51b2c60dbca5623a7fa90c2c0618c281a2282c60841739bd837731a51cc876f4ff369297f2f81 -EBUILD python-dateutil-2.8.0.ebuild 731 BLAKE2B 101e9c6687fa9617c1c0271b0f81a3efac421cc7899536ad7865d522a5e941ad4de42e0adc710ca42a0113a524b75b5b2bfdf0d6d59914afb6d5faf4138b335f SHA512 9b7beb9c59e0e16cef9cc554ba0be2f038d11771dc6635cdd44325ccc20b3dba163a5c44fad9178577c80c48b9c7deb762b402eaa6c71a674b635bcf8ef09dcb -MISC metadata.xml 466 BLAKE2B 9a89be6194b5010e55da1392afdf3e56f38957f09a0da3de6f394ac76a7b9fdde06a5d5ce4ac51ab0be3e0d0ad3fda7f56d4191ab149ee0ee4041d03a003ee67 SHA512 1a51af5341e6e55fada6952daff7411db2b454ffc1633231bcaba089f91cbb44f17e8c9d1dbe45fa75d399ef581ed45a6ac219089633c02376eea3e71d6b2aa1 +EBUILD python-dateutil-2.8.0.ebuild 1266 BLAKE2B 77e95ad8621cac6dbb076fd50de06e7c5fcdb381d046e7f4aa2100760c381938720a3717f6e5ad60bd6d1be5060f52ddca271e2800d4ea14b5a697ba6ef95a61 SHA512 299b1fa96c23259df45e52fee243018587b139fa28ed42b50e067eaa4fd38b46955d1333cb8ab715e7a121821c2afd45f7577b583b686ee8c7b2954215161718 +MISC metadata.xml 603 BLAKE2B 1bf49feeeec3ffc2f767228a84b3f9edf53cf44d8a1df3fa8f85798c0d3ea8f448d6113d425baa6b4b342b88746133d2770b951488d602dbb175f5ff9a99ea36 SHA512 87f5ea8b8918e72b57b91d32ed103d88f93ad9fbbe0a8f3f8b8ea72627d82e5cac25246553a0cb6988af26c30841ca5a3ddccf7f957603283a1b4e455a7c6439 diff --git a/dev-python/python-dateutil/files/0001-zoneinfo-Get-timezone-data-from-system-tzdata.patch b/dev-python/python-dateutil/files/0001-zoneinfo-Get-timezone-data-from-system-tzdata.patch new file mode 100644 index 000000000..2e3f4ee91 --- /dev/null +++ b/dev-python/python-dateutil/files/0001-zoneinfo-Get-timezone-data-from-system-tzdata.patch @@ -0,0 +1,104 @@ +From f48e70ae846c161dfbfe6ddb36e4bcad4427ac8c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Tue, 3 Apr 2018 22:03:32 +0200 +Subject: [PATCH] zoneinfo: Get timezone data from system tzdata + +--- + dateutil/test/test_imports.py | 3 +-- + dateutil/zoneinfo/__init__.py | 25 ++++++++++++++----------- + 2 files changed, 15 insertions(+), 13 deletions(-) + +diff --git a/dateutil/test/test_imports.py b/dateutil/test/test_imports.py +index 2a19b62..97d07e4 100644 +--- a/dateutil/test/test_imports.py ++++ b/dateutil/test/test_imports.py +@@ -158,9 +158,8 @@ class ImportZoneInfoTest(unittest.TestCase): + def testZoneinfoStar(self): + from dateutil.zoneinfo import gettz + from dateutil.zoneinfo import gettz_db_metadata +- from dateutil.zoneinfo import rebuild + +- zi_all = (gettz, gettz_db_metadata, rebuild) ++ zi_all = (gettz, gettz_db_metadata) + + for var in zi_all: + self.assertIsNot(var, None) +diff --git a/dateutil/zoneinfo/__init__.py b/dateutil/zoneinfo/__init__.py +index 34f11ad..e9870ca 100644 +--- a/dateutil/zoneinfo/__init__.py ++++ b/dateutil/zoneinfo/__init__.py +@@ -1,6 +1,7 @@ + # -*- coding: utf-8 -*- + import warnings + import json ++import os + + from tarfile import TarFile + from pkgutil import get_data +@@ -10,7 +11,7 @@ from dateutil.tz import tzfile as _tzfile + + __all__ = ["get_zonefile_instance", "gettz", "gettz_db_metadata"] + +-ZONEFILENAME = "dateutil-zoneinfo.tar.gz" ++ZONEDIRECTORY = "/usr/share/zoneinfo" + METADATA_FN = 'METADATA' + + +@@ -19,12 +20,14 @@ class tzfile(_tzfile): + return (gettz, (self._filename,)) + + +-def getzoneinfofile_stream(): +- try: +- return BytesIO(get_data(__name__, ZONEFILENAME)) +- except IOError as e: # TODO switch to FileNotFoundError? +- warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror)) +- return None ++def iter_zones(topdir): ++ for dirpath, dirnames, filenames in os.walk(topdir): ++ for f in filenames: ++ if f.endswith('.tab'): ++ continue ++ fpath = os.path.join(dirpath, f) ++ relpath = os.path.relpath(fpath, topdir) ++ yield (relpath, tzfile(fpath, filename=relpath)) + + + class ZoneInfoFile(object): +@@ -48,7 +51,7 @@ class ZoneInfoFile(object): + # no metadata in tar file + self.metadata = None + else: +- self.zones = {} ++ self.zones = dict(iter_zones(ZONEDIRECTORY)) + self.metadata = None + + def get(self, name, default=None): +@@ -99,7 +102,7 @@ def get_zonefile_instance(new_instance=False): + zif = getattr(get_zonefile_instance, '_cached_instance', None) + + if zif is None: +- zif = ZoneInfoFile(getzoneinfofile_stream()) ++ zif = ZoneInfoFile() + + get_zonefile_instance._cached_instance = zif + +@@ -140,7 +143,7 @@ def gettz(name): + DeprecationWarning) + + if len(_CLASS_ZONE_INSTANCE) == 0: +- _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream())) ++ _CLASS_ZONE_INSTANCE.append(ZoneInfoFile()) + return _CLASS_ZONE_INSTANCE[0].zones.get(name) + + +@@ -163,5 +166,5 @@ def gettz_db_metadata(): + DeprecationWarning) + + if len(_CLASS_ZONE_INSTANCE) == 0: +- _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream())) ++ _CLASS_ZONE_INSTANCE.append(ZoneInfoFile()) + return _CLASS_ZONE_INSTANCE[0].metadata +-- +2.17.0 + diff --git a/dev-python/python-dateutil/metadata.xml b/dev-python/python-dateutil/metadata.xml index 614434dce..4bee24c25 100644 --- a/dev-python/python-dateutil/metadata.xml +++ b/dev-python/python-dateutil/metadata.xml @@ -1,16 +1,17 @@ - + - - b@edevau.net - Andreas Billmeier + + python@gentoo.org + Python - python + + The dateutil module provides powerful extensions to the standard + datetime module, available in Python 2.3+. + python-dateutil - - dateutil@python.org - Paul Ganssle - + dateutil/dateutil + dateutil diff --git a/dev-python/python-dateutil/python-dateutil-2.8.0.ebuild b/dev-python/python-dateutil/python-dateutil-2.8.0.ebuild index f04aafc3e..bbfe20ad8 100644 --- a/dev-python/python-dateutil/python-dateutil-2.8.0.ebuild +++ b/dev-python/python-dateutil/python-dateutil-2.8.0.ebuild @@ -1,30 +1,50 @@ -# Copyright 1999-2019 Gentoo Authors Andreas Billmeier b (at) edevau.net -# Distributed under the terms of the GNU General Public License v3.0 +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 -EAPI="7" +EAPI=6 -PYTHON_COMPAT=( python3_{5,6,7} ) +PYTHON_COMPAT=( python2_7 python3_{4,5,6,7} pypy pypy3 ) inherit distutils-r1 DESCRIPTION="Extensions to the standard Python datetime module" -HOMEPAGE="https://dateutil.readthedocs.io https://pypi.org/project/python-dateutil/" -SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz" +HOMEPAGE=" + https://dateutil.readthedocs.org/ + https://pypi.org/project/python-dateutil + https://github.com/dateutil/dateutil/ +" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" -LICENSE="Dual License" +LICENSE="BSD" SLOT="0" -KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" +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" IUSE="test" -RDEPEND="" -DEPEND="${REDEPEND} +RDEPEND=" + >=dev-python/six-1.5[${PYTHON_USEDEP}] + sys-libs/timezone-data +" +DEPEND="${RDEPEND} + dev-python/setuptools_scm[${PYTHON_USEDEP}] dev-python/setuptools[${PYTHON_USEDEP}] test? ( - dev-python/nose[${PYTHON_USEDEP}] dev-python/pytest[${PYTHON_USEDEP}] - )" + dev-python/freezegun[${PYTHON_USEDEP}] + dev-python/hypothesis[${PYTHON_USEDEP}] + ) +" + +python_prepare_all() { + local PATCHES=( + "${FILESDIR}"/0001-zoneinfo-Get-timezone-data-from-system-tzdata.patch + ) + + # don't install zoneinfo tarball + sed -i '/package_data=/d' setup.py || die + + distutils-r1_python_prepare_all +} python_test() { - nosetests --verbose || die - py.test -v -v || die + py.test -v || die "Tests failed under ${EPYTHON}" }