diff --git a/no-utcfromtimestamp.patch b/no-utcfromtimestamp.patch new file mode 100644 index 0000000..0ad9414 --- /dev/null +++ b/no-utcfromtimestamp.patch @@ -0,0 +1,48 @@ +Index: python-dateutil-2.8.2/dateutil/tz/tz.py +=================================================================== +--- python-dateutil-2.8.2.orig/dateutil/tz/tz.py ++++ python-dateutil-2.8.2/dateutil/tz/tz.py +@@ -34,7 +34,7 @@ except ImportError: + from warnings import warn + + ZERO = datetime.timedelta(0) +-EPOCH = datetime.datetime.utcfromtimestamp(0) ++EPOCH = datetime.datetime.fromtimestamp(0, tz=datetime.timezone.utc) + EPOCHORDINAL = EPOCH.toordinal() + + +@@ -1809,9 +1809,9 @@ def resolve_imaginary(dt): + def _datetime_to_timestamp(dt): + """ + Convert a :class:`datetime.datetime` object to an epoch timestamp in +- seconds since January 1, 1970, ignoring the time zone. ++ seconds since January 1, 1970, forcing to UTC. + """ +- return (dt.replace(tzinfo=None) - EPOCH).total_seconds() ++ return (dt.replace(tzinfo=datetime.timezone.utc) - EPOCH).total_seconds() + + + if sys.version_info >= (3, 6): +Index: python-dateutil-2.8.2/dateutil/test/test_tz.py +=================================================================== +--- python-dateutil-2.8.2.orig/dateutil/test/test_tz.py ++++ python-dateutil-2.8.2/dateutil/test/test_tz.py +@@ -10,6 +10,7 @@ from datetime import tzinfo + from six import PY2 + from io import BytesIO, StringIO + import unittest ++import warnings + + import sys + import base64 +@@ -2809,3 +2810,10 @@ def test_resolve_imaginary(tzi, dt, dt_e + assert dt_r == dt_exp + assert dt_r.tzname() == dt_exp.tzname() + assert dt_r.utcoffset() == dt_exp.utcoffset() ++ ++ ++def test_epoch(): ++ # We're really try to see that no warnings are raised ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") ++ assert tz.EPOCH - tz.EPOCH == timedelta(0) diff --git a/python-python-dateutil.changes b/python-python-dateutil.changes index cf10ab4..d26f960 100644 --- a/python-python-dateutil.changes +++ b/python-python-dateutil.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 18 04:39:14 UTC 2023 - Steve Kowalik + +- Add patch no-utcfromtimestamp.patch, stop using a deprecated function. +- Switch to pyproject and autosetup macros. +- Stop using greedy globs in %files. + ------------------------------------------------------------------- Fri Apr 21 12:32:11 UTC 2023 - Dirk Müller diff --git a/python-python-dateutil.spec b/python-python-dateutil.spec index 418614f..94d6d0e 100644 --- a/python-python-dateutil.spec +++ b/python-python-dateutil.spec @@ -16,7 +16,6 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %define oldpython python %global flavor @BUILD_FLAVOR@%{nil} %if "%{flavor}" == "test" @@ -34,9 +33,12 @@ Summary: A Python Datetime Library License: Apache-2.0 OR BSD-3-Clause URL: https://dateutil.readthedocs.org/en/latest/ Source0: https://files.pythonhosted.org/packages/source/p/python-dateutil/python-dateutil-%{version}.tar.gz +Patch0: no-utcfromtimestamp.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools >= 24.3} BuildRequires: %{python_module setuptools_scm} BuildRequires: %{python_module six >= 1.5} +BuildRequires: %{python_module wheel} BuildRequires: dos2unix BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -86,16 +88,16 @@ datetime module. Orthodox or Julian algorithms. %prep -%setup -q -n python-dateutil-%{version} +%autosetup -p1 -n python-dateutil-%{version} #cleanup and MSdos style end of line separators dos2unix LICENSE NEWS PKG-INFO README.rst %build -%python_build +%pyproject_wheel %install %if !%{with test} -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %endif @@ -110,7 +112,8 @@ export LANG=en_US.UTF-8 %files %{python_files} %doc NEWS PKG-INFO README.rst %license LICENSE -%{python_sitelib}/* +%{python_sitelib}/dateutil +%{python_sitelib}/python_dateutil-%{version}.dist-info %endif %changelog