commit:     527964469cc360ae78862df57d6bf1f57d17c9fd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 10 09:52:06 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 10 10:53:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52796446

dev-python/tables: Enable py3.13

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

 dev-python/tables/files/tables-3.9.2-py313.patch | 73 ++++++++++++++++++++++++
 dev-python/tables/tables-3.9.2-r1.ebuild         | 11 +++-
 2 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/dev-python/tables/files/tables-3.9.2-py313.patch 
b/dev-python/tables/files/tables-3.9.2-py313.patch
new file mode 100644
index 000000000000..660c5615765f
--- /dev/null
+++ b/dev-python/tables/files/tables-3.9.2-py313.patch
@@ -0,0 +1,73 @@
+From 4a1b480e7e3758cf2cf06354ec5720020db16ce7 Mon Sep 17 00:00:00 2001
+From: Antonio Valentino <antonio.valent...@tiscali.it>
+Date: Sun, 19 May 2024 17:39:47 +0200
+Subject: [PATCH] Fix compatibility with Python v3.13 (Closes: #1166)
+
+The unittest.makeSuite function is not available in Python 3.13.
+---
+diff --git a/tables/tests/test_aux.py b/tables/tests/test_aux.py
+index 95f34ee16..cf4f022de 100644
+--- a/tables/tests/test_aux.py
++++ b/tables/tests/test_aux.py
+@@ -2,6 +2,7 @@
+ import numpy as np
+ 
+ import tables as tb
++from tables.tests.common import make_suite
+ 
+ 
+ class TestAuxiliaryFunctions(unittest.TestCase):
+diff --git a/tables/nodes/tests/test_filenode.py 
b/tables/nodes/tests/test_filenode.py
+index c2754218a..3572cc38f 100644
+--- a/tables/nodes/tests/test_filenode.py
++++ b/tables/nodes/tests/test_filenode.py
+@@ -9,7 +9,7 @@
+ from ... import open_file, file, NoSuchNodeError
+ from ...nodes import filenode
+ from ...tests.common import (
+-    unittest, TempFileMixin, parse_argv, print_versions,
++    unittest, TempFileMixin, parse_argv, print_versions, make_suite,
+     PyTablesTestCase as TestCase)
+ 
+ 
+diff --git a/tables/tests/common.py b/tables/tests/common.py
+index 31378a880..918b17247 100644
+--- a/tables/tests/common.py
++++ b/tables/tests/common.py
+@@ -366,3 +366,10 @@ def test00(self):
+         print(f"VmSize: {vmsize:>7} kB\tVmRSS: {vmrss:>7} kB")
+         print(f"VmData: {vmdata:>7} kB\tVmStk: {vmstk:>7} kB")
+         print(f"VmExe:  {vmexe:>7} kB\tVmLib: {vmlib:>7} kB")
++
++
++try:
++    from unittest import makeSuite as make_suite
++except ImportError:
++    def make_suite(test_case_class):
++        return unittest.TestLoader().loadTestsFromTestCase(test_case_class)
+From 424784895b0fb15ad06707ce60f9829cef4f11e2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <m...@hroncok.cz>
+Date: Mon, 3 Jun 2024 17:21:38 +0200
+Subject: [PATCH] Make tables.tests.common.make_suite() accept the prefix
+ argument
+
+...as test_queries.py uses it.
+---
+ tables/tests/common.py | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/tables/tests/common.py b/tables/tests/common.py
+index 918b17247..1d2e5feab 100644
+--- a/tables/tests/common.py
++++ b/tables/tests/common.py
+@@ -371,5 +371,8 @@ def test00(self):
+ try:
+     from unittest import makeSuite as make_suite
+ except ImportError:
+-    def make_suite(test_case_class):
+-        return unittest.TestLoader().loadTestsFromTestCase(test_case_class)
++    def make_suite(test_case_class, *, prefix=None):
++        loader = unittest.TestLoader()
++        if prefix:
++            loader.testMethodPrefix = prefix
++        return loader.loadTestsFromTestCase(test_case_class)

diff --git a/dev-python/tables/tables-3.9.2-r1.ebuild 
b/dev-python/tables/tables-3.9.2-r1.ebuild
index bdbc563361d3..0f77247031d8 100644
--- a/dev-python/tables/tables-3.9.2-r1.ebuild
+++ b/dev-python/tables/tables-3.9.2-r1.ebuild
@@ -5,7 +5,7 @@ EAPI=8
 
 DISTUTILS_EXT=1
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( pypy3 python3_{10..12} )
+PYTHON_COMPAT=( pypy3 python3_{10..13} )
 PYTHON_REQ_USE="threads(+)"
 
 inherit distutils-r1 prefix pypi
@@ -52,10 +52,19 @@ python_prepare_all() {
        local PATCHES=(
                # https://github.com/PyTables/PyTables/pull/1176
                "${FILESDIR}/${P}-numpy-2.patch"
+               # 
https://github.com/PyTables/PyTables/commit/4a1b480e7e3758cf2cf06354ec5720020db16ce7
+               # 
https://github.com/PyTables/PyTables/commit/424784895b0fb15ad06707ce60f9829cef4f11e2
+               "${FILESDIR}/${P}-py313.patch"
        )
 
        rm -r c-blosc/{blosc,internal-complibs} || die
 
+       # part of 
https://github.com/PyTables/PyTables/commit/4a1b480e7e3758cf2cf06354ec5720020db16ce7
+       # (warning: do it *before* patching, so it doesn't modify
+       # the added function)
+       find -name '*.py' -exec \
+               sed -i -e 's:unittest[.]makeSuite:make_suite:' {} + || die
+
        distutils-r1_python_prepare_all
 
        sed -i -e '/blosc2/d' pyproject.toml || die

Reply via email to