commit:     0f6b81add9892f5b992ced39c8f02d2ec57885c7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 21 06:56:07 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 21 07:24:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f6b81ad

dev-python/isodate: Port to py3.10

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/isodate/files/isodate-0.6.0-py310.patch | 95 ++++++++++++++++++++++
 ...ate-0.6.0-r1.ebuild => isodate-0.6.0-r2.ebuild} | 20 ++---
 2 files changed, 105 insertions(+), 10 deletions(-)

diff --git a/dev-python/isodate/files/isodate-0.6.0-py310.patch 
b/dev-python/isodate/files/isodate-0.6.0-py310.patch
new file mode 100644
index 00000000000..81b38b48a2a
--- /dev/null
+++ b/dev-python/isodate/files/isodate-0.6.0-py310.patch
@@ -0,0 +1,95 @@
+From 40358ac82b948ea8377d5ca32b576def31b39a84 Mon Sep 17 00:00:00 2001
+From: Jose Eduardo <[email protected]>
+Date: Fri, 19 Jul 2019 16:21:56 +0100
+Subject: [PATCH 1/8] Avoid unclosed file warning
+
+---
+ setup.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index e39446f..9634625 100644
+--- a/setup.py
++++ b/setup.py
+@@ -30,7 +30,8 @@
+ 
+ 
+ def read(*rnames):
+-    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
++    with open(os.path.join(os.path.dirname(__file__), *rnames)) as read_file:
++        return read_file.read()
+ 
+ 
+ setup(name='isodate',
+
+From 91bf24dd1610d5f6ac5d4867457f0703046017d2 Mon Sep 17 00:00:00 2001
+From: Jose Eduardo <[email protected]>
+Date: Fri, 19 Jul 2019 16:22:22 +0100
+Subject: [PATCH 2/8] Raise warnings produced by isodate as errors during tests
+
+---
+ src/isodate/tests/__init__.py | 3 +++
+ tox.ini                       | 2 ++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/src/isodate/tests/__init__.py b/src/isodate/tests/__init__.py
+index b1d46bd..7208cbd 100644
+--- a/src/isodate/tests/__init__.py
++++ b/src/isodate/tests/__init__.py
+@@ -29,6 +29,7 @@
+ '''
+ 
+ import unittest
++import warnings
+ from isodate.tests import (test_date, test_time, test_datetime, test_duration,
+                            test_strf, test_pickle)
+ 
+@@ -37,6 +38,8 @@ def test_suite():
+     '''
+     Return a new TestSuite instance consisting of all available TestSuites.
+     '''
++    warnings.filterwarnings("error", module=r"isodate(\..)*")
++
+     return unittest.TestSuite([
+         test_date.test_suite(),
+         test_time.test_suite(),
+
+From fc0fb3278da5f463ca5b2f0a3acafbbf2869bd7a Mon Sep 17 00:00:00 2001
+From: Jose Eduardo <[email protected]>
+Date: Fri, 19 Jul 2019 16:29:43 +0100
+Subject: [PATCH 4/8] Fix Python 3.8 DeprecationWarning
+
+Ref: https://docs.python.org/3.8/whatsnew/3.8.html
+
+> Many builtin and extension functions that take integer arguments will
+> now emit a deprecation warning for Decimals, Fractions and any other
+> objects that can be converted to integers only with a loss (e.g. that
+> have the `__int__()` method but do not have the `__index__()` method).
+> In future version they will be errors. (Contributed by Serhiy
+> Storchaka in bpo-36048.)
+---
+ src/isodate/duration.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/isodate/duration.py b/src/isodate/duration.py
+index 6d1848c..d923cee 100644
+--- a/src/isodate/duration.py
++++ b/src/isodate/duration.py
+@@ -180,7 +180,7 @@ 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=newday)
+             # does a timedelta + date/datetime
+             return self.tdelta + newdt
+         except AttributeError:
+@@ -264,7 +264,7 @@ 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=newday)
+             return newdt - self.tdelta
+         except AttributeError:
+             # other probably was not compatible with data/datetime

diff --git a/dev-python/isodate/isodate-0.6.0-r1.ebuild 
b/dev-python/isodate/isodate-0.6.0-r2.ebuild
similarity index 62%
rename from dev-python/isodate/isodate-0.6.0-r1.ebuild
rename to dev-python/isodate/isodate-0.6.0-r2.ebuild
index cbd14a1fcff..4b9e27d5136 100644
--- a/dev-python/isodate/isodate-0.6.0-r1.ebuild
+++ b/dev-python/isodate/isodate-0.6.0-r2.ebuild
@@ -1,10 +1,9 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7..9} pypy3 )
+EAPI=8
 
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
 inherit distutils-r1
 
 DESCRIPTION="ISO 8601 date/time/duration parser and formatter"
@@ -14,14 +13,15 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 sparc x86 
~amd64-linux ~x86-linux"
-IUSE="test"
-RESTRICT="!test? ( test )"
 
 RDEPEND="dev-python/six[${PYTHON_USEDEP}]"
-BDEPEND="
-       test? ( ${RDEPEND} )"
+
+distutils_enable_tests unittest
+
+PATCHES=(
+       "${FILESDIR}"/${P}-py310.patch
+)
 
 python_test() {
-       "${EPYTHON}" -m unittest discover -v -s "${BUILD_DIR}/lib" \
-               || die "Testing failed with ${EPYTHON}"
+       eunittest -s "${BUILD_DIR}/lib"
 }

Reply via email to