summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Sautier <sbraz@gentoo.org>2024-05-12 16:03:49 +0200
committerLouis Sautier <sbraz@gentoo.org>2024-05-12 16:12:06 +0200
commit79716aeed4c9440379bb8236a9e857270ae94290 (patch)
tree97ccf6b3d0ab665f55f89f9925e193f61de4398e
parentdev-lisp/sbcl: remove old version (diff)
downloadgentoo-79716aeed4c9440379bb8236a9e857270ae94290.tar.gz
gentoo-79716aeed4c9440379bb8236a9e857270ae94290.tar.bz2
gentoo-79716aeed4c9440379bb8236a9e857270ae94290.zip
app-arch/cfv: enable py3.12
New patches were required but they only affect the test suite, not the runtime files. Closes: https://bugs.gentoo.org/929279 Signed-off-by: Louis Sautier <sbraz@gentoo.org>
-rw-r--r--app-arch/cfv/cfv-3.0.0.ebuild11
-rw-r--r--app-arch/cfv/files/cfv-3.0.0-fix-removed-assertequal.patch39
-rw-r--r--app-arch/cfv/files/cfv-3.0.0-fix-removed-imp.patch39
3 files changed, 87 insertions, 2 deletions
diff --git a/app-arch/cfv/cfv-3.0.0.ebuild b/app-arch/cfv/cfv-3.0.0.ebuild
index 02f12d0e670c..239956198afc 100644
--- a/app-arch/cfv/cfv-3.0.0.ebuild
+++ b/app-arch/cfv/cfv-3.0.0.ebuild
@@ -1,11 +1,11 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
# Tests fail with pypy3 as of PyPy 7.3.9 / Python 3.9.12
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{10..12} )
inherit distutils-r1 optfeature
@@ -26,6 +26,13 @@ BDEPEND="
)
"
+PATCHES=(
+ # Backported from https://github.com/cfv-project/cfv/commit/5259bcbe3434c6974f7a65cc435dd0b4cfc3f864
+ "${FILESDIR}/${P}-fix-removed-assertequal.patch"
+ # See https://github.com/cfv-project/cfv/pull/53
+ "${FILESDIR}/${P}-fix-removed-imp.patch"
+)
+
python_prepare_all() {
# Remove upstream's attempt to install the man page
sed -i '/\sdata_files=/d' setup.py || die
diff --git a/app-arch/cfv/files/cfv-3.0.0-fix-removed-assertequal.patch b/app-arch/cfv/files/cfv-3.0.0-fix-removed-assertequal.patch
new file mode 100644
index 000000000000..aa7820d03a92
--- /dev/null
+++ b/app-arch/cfv/files/cfv-3.0.0-fix-removed-assertequal.patch
@@ -0,0 +1,39 @@
+commit 5259bcbe3434c6974f7a65cc435dd0b4cfc3f864
+Author: Louis Sautier <sautier.louis@gmail.com>
+Date: Tue Nov 1 15:48:21 2022 +0100
+
+ tests: use assertEqual instead of assertEquals
+
+ The latter is deprecated and causes warnings when running tests.
+
+--- a/test/test_caching.py
++++ b/test/test_caching.py
+@@ -136,18 +136,18 @@ class RelPathKeyTest(RelTestCase):
+ self.mkfile('aAaA/Aaa2', '2')
+ self.mkfile('aAaA/AAa2', '3')
+
+- self.assertEquals(a1, cache.nocase_findfile(self.mkpath('aaAA/aaa1')))
++ self.assertEqual(a1, cache.nocase_findfile(self.mkpath('aaAA/aaa1')))
+ with self.assertRaises(IOError) as cm:
+ cache.nocase_findfile(self.mkpath('aaAb/aaa1'))
+- self.assertEquals(errno.ENOENT, cm.exception.errno)
++ self.assertEqual(errno.ENOENT, cm.exception.errno)
+
+ with self.assertRaises(IOError) as cm:
+ cache.nocase_findfile(self.mkpath('aaAA/aab1'))
+- self.assertEquals(errno.ENOENT, cm.exception.errno)
++ self.assertEqual(errno.ENOENT, cm.exception.errno)
+
+ with self.assertRaises(IOError) as cm:
+ cache.nocase_findfile(self.mkpath('aaAA/aaa2'))
+- self.assertEquals(errno.EEXIST, cm.exception.errno)
++ self.assertEqual(errno.EEXIST, cm.exception.errno)
+
+ def test_nocase_findfile_parent(self):
+ cache = FileInfoCache()
+@@ -159,4 +159,4 @@ class RelPathKeyTest(RelTestCase):
+ # one.
+ with self.assertRaises(IOError) as cm:
+ cache.nocase_findfile(self.mkpath('aaAA/aaa2'))
+- self.assertEquals(errno.EEXIST, cm.exception.errno)
++ self.assertEqual(errno.EEXIST, cm.exception.errno)
diff --git a/app-arch/cfv/files/cfv-3.0.0-fix-removed-imp.patch b/app-arch/cfv/files/cfv-3.0.0-fix-removed-imp.patch
new file mode 100644
index 000000000000..d4fa6e9aeb29
--- /dev/null
+++ b/app-arch/cfv/files/cfv-3.0.0-fix-removed-imp.patch
@@ -0,0 +1,39 @@
+commit ecf720058f63930d53075584a59cf42e035347eb
+Author: Louis Sautier <sautier.louis@gmail.com>
+Date: Sun May 12 15:44:26 2024 +0200
+
+ Fix tests for Python 3.12: remove "imp", fixes #21, #44
+
+ The "imp" module was removed in Python 3.12.
+ The replacement functions were added in Python 3.5, see
+ https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_file_location
+ https://docs.python.org/3/library/importlib.html#importlib.util.module_from_spec
+
+--- a/test/cfvtest.py
++++ b/test/cfvtest.py
+@@ -23,8 +23,8 @@ from builtins import map
+ from builtins import object
+
+ import fnmatch
+-import imp
+ import importlib
++import importlib.util
+ import os
+ import shlex
+ import sys
+@@ -201,8 +201,14 @@ def setcfv(fn=None, internal=None):
+ cfv_compiled = compile(_cfv_code, cfvfn, 'exec')
+
+ with open(cfvfn, 'rt') as f:
++ # For spec_from_file_location to accept a file without the .py suffix ("cfv")
++ importlib.machinery.SOURCE_SUFFIXES.append('')
++ spec = importlib.util.spec_from_file_location('cfvwrapper', cfvfn)
++ module = importlib.util.module_from_spec(spec)
+ # This is so that the sys.path modification of the wrapper (if it has one) will be executed..
+- imp.load_source('cfvwrapper', cfvfn, f)
++ spec.loader.exec_module(module)
++ # Restore SOURCE_SUFFIXES to its default value
++ importlib.machinery.SOURCE_SUFFIXES.pop()
+
+ get_version_flags()
+