- 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
This commit is contained in:
Steve Kowalik 2021-12-13 01:45:16 +00:00 committed by Git OBS Bridge
parent 95ebc3126d
commit 854684b73b
3 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 201720a3717426c33ff114b3169ac6d7d29de2c0 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <hugovk@users.noreply.github.com>
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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Dec 13 01:44:25 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch coerce-decimal-to-int-python-310.patch:
* Support Python 3.10.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Nov 8 10:20:27 UTC 2021 - Dirk Müller <dmueller@suse.com> Mon Nov 8 10:20:27 UTC 2021 - Dirk Müller <dmueller@suse.com>

View File

@ -22,9 +22,10 @@ Version: 0.6.0
Release: 0 Release: 0
Summary: An ISO 8601 Date/Time/Duration Parser and Formatter Summary: An ISO 8601 Date/Time/Duration Parser and Formatter
License: BSD-3-Clause License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://pypi.org/project/isodate/ URL: https://pypi.org/project/isodate/
Source: https://files.pythonhosted.org/packages/source/i/isodate/isodate-%{version}.tar.gz 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 setuptools}
BuildRequires: %{python_module six} BuildRequires: %{python_module six}
BuildRequires: fdupes BuildRequires: fdupes
@ -42,6 +43,7 @@ option.
%prep %prep
%setup -q -n isodate-%{version} %setup -q -n isodate-%{version}
%autopatch -p1
%build %build
%python_build %python_build