summaryrefslogtreecommitdiff
path: root/dev-python/python-dateutil
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/python-dateutil')
-rw-r--r--dev-python/python-dateutil/Manifest1
-rw-r--r--dev-python/python-dateutil/files/python-dateutil-2.9.0-no-pytest-cov.patch18
-rw-r--r--dev-python/python-dateutil/files/python-dateutil-2.9.0-system-tzdata.patch91
-rw-r--r--dev-python/python-dateutil/metadata.xml18
-rw-r--r--dev-python/python-dateutil/python-dateutil-2.9.0_p0.ebuild62
5 files changed, 190 insertions, 0 deletions
diff --git a/dev-python/python-dateutil/Manifest b/dev-python/python-dateutil/Manifest
new file mode 100644
index 000000000000..82d26649de2c
--- /dev/null
+++ b/dev-python/python-dateutil/Manifest
@@ -0,0 +1 @@
+DIST python-dateutil-2.9.0.post0.tar.gz 342432 BLAKE2B b3469ff9900afd98f474f162083570c28ac93378efc772b5f365fa0d5d4354a96867a024065adc430b71d7bde6909195ac4ebe3ad1d17e638fded0b4b40f9954 SHA512 f76522de0ff21547327eaf6966e80a15c57f8f92588d520eabd354a732e5c4b51d9c3ac5effd9eaa6dd451d1bce329a54a3f4c6bf4f1bd08ff06b0305c994e5a
diff --git a/dev-python/python-dateutil/files/python-dateutil-2.9.0-no-pytest-cov.patch b/dev-python/python-dateutil/files/python-dateutil-2.9.0-no-pytest-cov.patch
new file mode 100644
index 000000000000..d483451a0adf
--- /dev/null
+++ b/dev-python/python-dateutil/files/python-dateutil-2.9.0-no-pytest-cov.patch
@@ -0,0 +1,18 @@
+diff --git a/tests/conftest.py b/tests/conftest.py
+index 78ed70a..4bb4c0a 100644
+--- a/tests/conftest.py
++++ b/tests/conftest.py
+@@ -14,10 +14,11 @@ def pytest_collection_modifyitems(items):
+
+ marker = marker_getter('xfail')
+
++ # requires pytest-cov
+ # Need to query the args because conditional xfail tests still have
+ # the xfail mark even if they are not expected to fail
+- if marker and (not marker.args or marker.args[0]):
+- item.add_marker(pytest.mark.no_cover)
++ #if marker and (not marker.args or marker.args[0]):
++ # item.add_marker(pytest.mark.no_cover)
+
+
+ def set_tzpath():
diff --git a/dev-python/python-dateutil/files/python-dateutil-2.9.0-system-tzdata.patch b/dev-python/python-dateutil/files/python-dateutil-2.9.0-system-tzdata.patch
new file mode 100644
index 000000000000..08a983d9f6a2
--- /dev/null
+++ b/dev-python/python-dateutil/files/python-dateutil-2.9.0-system-tzdata.patch
@@ -0,0 +1,91 @@
+diff --git a/src/dateutil/zoneinfo/__init__.py b/src/dateutil/zoneinfo/__init__.py
+index 34f11ad..e3f0f94 100644
+--- a/src/dateutil/zoneinfo/__init__.py
++++ b/src/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(('.list', '.tab', '.zi', 'leapseconds')):
++ 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
+diff --git a/tests/test_imports.py b/tests/test_imports.py
+index 7d0749e..4256f45 100644
+--- a/tests/test_imports.py
++++ b/tests/test_imports.py
+@@ -232,9 +232,8 @@ def test_import_zone_info_from():
+ def test_import_zone_info_star():
+ 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:
+ assert var is not None
diff --git a/dev-python/python-dateutil/metadata.xml b/dev-python/python-dateutil/metadata.xml
new file mode 100644
index 000000000000..32cce9bc255a
--- /dev/null
+++ b/dev-python/python-dateutil/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <longdescription lang="en">
+ The dateutil module provides powerful extensions to the standard
+ datetime module, available in Python 2.3+.
+ </longdescription>
+ <stabilize-allarches/>
+ <upstream>
+ <remote-id type="pypi">python-dateutil</remote-id>
+ <remote-id type="github">dateutil/dateutil</remote-id>
+ <remote-id type="launchpad">dateutil</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-python/python-dateutil/python-dateutil-2.9.0_p0.ebuild b/dev-python/python-dateutil/python-dateutil-2.9.0_p0.ebuild
new file mode 100644
index 000000000000..e592f30a6a2a
--- /dev/null
+++ b/dev-python/python-dateutil/python-dateutil-2.9.0_p0.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYPI_NO_NORMALIZE=1
+PYTHON_FULLY_TESTED=( python3_{11..14} python3_{13..14}t )
+PYTHON_COMPAT=( python3_{13..14} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Extensions to the standard Python datetime module"
+HOMEPAGE="
+ https://dateutil.readthedocs.io/
+ https://pypi.org/project/python-dateutil/
+ https://github.com/dateutil/dateutil/
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos"
+
+RDEPEND="
+ >=dev-python/six-1.5[${PYTHON_USEDEP}]
+ sys-libs/timezone-data
+"
+BDEPEND="
+ dev-python/setuptools-scm[${PYTHON_USEDEP}]
+ test? (
+ dev-python/freezegun[${PYTHON_USEDEP}]
+ $(python_gen_cond_dep '
+ dev-python/hypothesis[${PYTHON_USEDEP}]
+ ' "${PYTHON_FULLY_TESTED[@]}")
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}/python-dateutil-2.9.0-system-tzdata.patch"
+ "${FILESDIR}/python-dateutil-2.9.0-no-pytest-cov.patch"
+)
+
+EPYTEST_PLUGINS=()
+distutils_enable_tests pytest
+
+python_prepare_all() {
+ # don't install zoneinfo tarball
+ sed -i '/package_data=/d' setup.py || die
+
+ distutils-r1_python_prepare_all
+}
+
+python_test() {
+ local EPYTEST_IGNORE=()
+ if ! has_version "dev-python/hypothesis[${PYTHON_USEDEP}]"; then
+ EPYTEST_IGNORE+=(
+ tests/property
+ )
+ fi
+
+ epytest
+}