commit:     cd4c41b233a8cadf852ad8789bb2fdc471c3d455
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Mon Nov  6 10:18:01 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Mon Nov  6 10:46:39 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd4c41b2

dev-python/joblib: enable py3.12

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 .../joblib-1.3.2-py3.12-avoid-ast.num-and-node.n.patch    | 15 +++++++++++++++
 .../joblib/files/joblib-1.3.2-py3.12-no-depr-warn.patch   | 15 +++++++++++++++
 dev-python/joblib/joblib-1.3.2.ebuild                     |  9 ++++++++-
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git 
a/dev-python/joblib/files/joblib-1.3.2-py3.12-avoid-ast.num-and-node.n.patch 
b/dev-python/joblib/files/joblib-1.3.2-py3.12-avoid-ast.num-and-node.n.patch
new file mode 100644
index 000000000000..a9865e00380e
--- /dev/null
+++ b/dev-python/joblib/files/joblib-1.3.2-py3.12-avoid-ast.num-and-node.n.patch
@@ -0,0 +1,15 @@
+diff --git a/joblib/_utils.py b/joblib/_utils.py
+index 7693310e0..6cd99ad31 100644
+--- a/joblib/_utils.py
++++ b/joblib/_utils.py
+@@ -35,8 +35,8 @@ def eval_expr(expr):
+ 
+ 
+ def eval_(node):
+-    if isinstance(node, ast.Num):  # <number>
+-        return node.n
++    if isinstance(node, ast.Constant):  # <constant>
++        return node.value
+     elif isinstance(node, ast.BinOp):  # <left> <operator> <right>
+         return operators[type(node.op)](eval_(node.left), eval_(node.right))
+     elif isinstance(node, ast.UnaryOp):  # <operator> <operand> e.g., -1

diff --git a/dev-python/joblib/files/joblib-1.3.2-py3.12-no-depr-warn.patch 
b/dev-python/joblib/files/joblib-1.3.2-py3.12-no-depr-warn.patch
new file mode 100644
index 000000000000..4d5a28815e4a
--- /dev/null
+++ b/dev-python/joblib/files/joblib-1.3.2-py3.12-no-depr-warn.patch
@@ -0,0 +1,15 @@
+diff --git a/joblib/test/test_parallel.py b/joblib/test/test_parallel.py
+index 906d436..c4a727c 100644
+--- a/joblib/test/test_parallel.py
++++ b/joblib/test/test_parallel.py
+@@ -189,6 +189,10 @@ def test_main_thread_renamed_no_warning(backend, 
monkeypatch):
+     # warninfo catches Warnings from worker timeouts. We remove it if it 
exists
+     warninfo = [w for w in warninfo if "worker timeout" not in str(w.message)]
+
++    # We don't want to count DeprecationWarnings
++    warninfo = [w for w in warninfo
++                if not isinstance(w.message, DeprecationWarning)]
++
+     # The multiprocessing backend will raise a warning when detecting that is
+     # started from the non-main thread. Let's check that there is no false
+     # positive because of the name change.

diff --git a/dev-python/joblib/joblib-1.3.2.ebuild 
b/dev-python/joblib/joblib-1.3.2.ebuild
index 672bc72702d8..d44046dcaed6 100644
--- a/dev-python/joblib/joblib-1.3.2.ebuild
+++ b/dev-python/joblib/joblib-1.3.2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{10..11} )
+PYTHON_COMPAT=( python3_{10..12} )
 DISTUTILS_USE_PEP517=setuptools
 
 inherit distutils-r1 pypi
@@ -31,6 +31,13 @@ BDEPEND="
        )
 "
 
+PATCHES=(
+       # Borrowed from Fedora: https://github.com/joblib/joblib/issues/1478
+       "${FILESDIR}/${P}-py3.12-no-depr-warn.patch"
+       # https://github.com/joblib/joblib/pull/1518
+       "${FILESDIR}/${P}-py3.12-avoid-ast.num-and-node.n.patch"
+)
+
 distutils_enable_tests pytest
 
 EPYTEST_DESELECT=(

Reply via email to