From 854684b73b0e0b7be61ab2442c1d94751446433f0f97db06abbe3e93a6f6d01b Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 13 Dec 2021 01:45:16 +0000 Subject: [PATCH] - Add patch coerce-decimal-to-int-python-310.patch: * Support Python 3.10. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-isodate?expand=0&rev=29 --- coerce-decimal-to-int-python-310.patch | 37 ++++++++++++++++++++++++++ python-isodate.changes | 6 +++++ python-isodate.spec | 4 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 coerce-decimal-to-int-python-310.patch diff --git a/coerce-decimal-to-int-python-310.patch b/coerce-decimal-to-int-python-310.patch new file mode 100644 index 0000000..1e858ad --- /dev/null +++ b/coerce-decimal-to-int-python-310.patch @@ -0,0 +1,37 @@ +From 201720a3717426c33ff114b3169ac6d7d29de2c0 Mon Sep 17 00:00:00 2001 +From: Hugo van Kemenade +Date: Mon, 13 Sep 2021 12:38:36 +0300 +Subject: [PATCH 3/4] Fix for Python 3.10: TypeError: 'decimal.Decimal' object + cannot be interpreted as an integer + +--- + src/isodate/duration.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/isodate/duration.py b/src/isodate/duration.py +index 6d1848c..4b83e45 100644 +--- a/src/isodate/duration.py ++++ b/src/isodate/duration.py +@@ -180,7 +180,9 @@ def __add__(self, other): + newday = maxdays + else: + newday = other.day +- newdt = other.replace(year=newyear, month=newmonth, day=newday) ++ newdt = other.replace( ++ year=int(newyear), month=int(newmonth), day=int(newday) ++ ) + # does a timedelta + date/datetime + return self.tdelta + newdt + except AttributeError: +@@ -264,7 +266,9 @@ def __rsub__(self, other): + newday = maxdays + else: + newday = other.day +- newdt = other.replace(year=newyear, month=newmonth, day=newday) ++ newdt = other.replace( ++ year=int(newyear), month=int(newmonth), day=int(newday) ++ ) + return newdt - self.tdelta + except AttributeError: + # other probably was not compatible with data/datetime + diff --git a/python-isodate.changes b/python-isodate.changes index 3bd8012..2c1b847 100644 --- a/python-isodate.changes +++ b/python-isodate.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Dec 13 01:44:25 UTC 2021 - Steve Kowalik + +- Add patch coerce-decimal-to-int-python-310.patch: + * Support Python 3.10. + ------------------------------------------------------------------- Mon Nov 8 10:20:27 UTC 2021 - Dirk Müller diff --git a/python-isodate.spec b/python-isodate.spec index 1d790da..88ed19a 100644 --- a/python-isodate.spec +++ b/python-isodate.spec @@ -22,9 +22,10 @@ Version: 0.6.0 Release: 0 Summary: An ISO 8601 Date/Time/Duration Parser and Formatter License: BSD-3-Clause -Group: Development/Languages/Python URL: https://pypi.org/project/isodate/ Source: https://files.pythonhosted.org/packages/source/i/isodate/isodate-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#gweis/isodate#68 +Patch0: coerce-decimal-to-int-python-310.patch BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} BuildRequires: fdupes @@ -42,6 +43,7 @@ option. %prep %setup -q -n isodate-%{version} +%autopatch -p1 %build %python_build