- Add patch no-utcfromtimestamp.patch, stop using a deprecated function.
- Switch to pyproject and autosetup macros. - Stop using greedy globs in %files. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-dateutil?expand=0&rev=28
This commit is contained in:
parent
f62684b5d6
commit
99034ec70a
48
no-utcfromtimestamp.patch
Normal file
48
no-utcfromtimestamp.patch
Normal file
@ -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)
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 18 04:39:14 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- 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 <dmueller@suse.com>
|
Fri Apr 21 12:32:11 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
|
||||||
%define oldpython python
|
%define oldpython python
|
||||||
%global flavor @BUILD_FLAVOR@%{nil}
|
%global flavor @BUILD_FLAVOR@%{nil}
|
||||||
%if "%{flavor}" == "test"
|
%if "%{flavor}" == "test"
|
||||||
@ -34,9 +33,12 @@ Summary: A Python Datetime Library
|
|||||||
License: Apache-2.0 OR BSD-3-Clause
|
License: Apache-2.0 OR BSD-3-Clause
|
||||||
URL: https://dateutil.readthedocs.org/en/latest/
|
URL: https://dateutil.readthedocs.org/en/latest/
|
||||||
Source0: https://files.pythonhosted.org/packages/source/p/python-dateutil/python-dateutil-%{version}.tar.gz
|
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 >= 24.3}
|
||||||
BuildRequires: %{python_module setuptools_scm}
|
BuildRequires: %{python_module setuptools_scm}
|
||||||
BuildRequires: %{python_module six >= 1.5}
|
BuildRequires: %{python_module six >= 1.5}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: dos2unix
|
BuildRequires: dos2unix
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
@ -86,16 +88,16 @@ datetime module.
|
|||||||
Orthodox or Julian algorithms.
|
Orthodox or Julian algorithms.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n python-dateutil-%{version}
|
%autosetup -p1 -n python-dateutil-%{version}
|
||||||
#cleanup and MSdos style end of line separators
|
#cleanup and MSdos style end of line separators
|
||||||
dos2unix LICENSE NEWS PKG-INFO README.rst
|
dos2unix LICENSE NEWS PKG-INFO README.rst
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%if !%{with test}
|
%if !%{with test}
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -110,7 +112,8 @@ export LANG=en_US.UTF-8
|
|||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%doc NEWS PKG-INFO README.rst
|
%doc NEWS PKG-INFO README.rst
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%{python_sitelib}/*
|
%{python_sitelib}/dateutil
|
||||||
|
%{python_sitelib}/python_dateutil-%{version}.dist-info
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
Reference in New Issue
Block a user