From 246c83e768dd1efb42047de864a1e92b73de8b5c Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 27 May 2023 15:12:15 +0100 Subject: gentoo auto-resync : 27:05:2023 - 15:12:15 --- dev-python/cffi/Manifest | 2 + dev-python/cffi/cffi-1.15.1-r3.ebuild | 81 +++++++++ dev-python/cffi/files/cffi-1.15.1-py312.patch | 247 ++++++++++++++++++++++++++ 3 files changed, 330 insertions(+) create mode 100644 dev-python/cffi/cffi-1.15.1-r3.ebuild create mode 100644 dev-python/cffi/files/cffi-1.15.1-py312.patch (limited to 'dev-python/cffi') diff --git a/dev-python/cffi/Manifest b/dev-python/cffi/Manifest index aa040573c914..ce7ddbbd818e 100644 --- a/dev-python/cffi/Manifest +++ b/dev-python/cffi/Manifest @@ -1,7 +1,9 @@ AUX cffi-1.14.0-darwin-no-brew.patch 568 BLAKE2B 43afdb086a0385e913f287bc5c1534df1b881058cf7efdfdecd9df063c27ebd26683edad43e3010e1c01d9d93c5d98785ffbe65a5e3317d96ebb6a3132aecdab SHA512 75335871b8f98223e0247defc3d08f1c10ebed58c79790826c4e39057e6757b8bdc07e2773ad25482ed17c13480b3e72b3667e48697a456ed0cc4a39e7d91b79 AUX cffi-1.15.1-hppa.patch 2097 BLAKE2B 2cd3a1b155b71bcb3d70e3659950c45c36959f0c2090fe560d47bf60e53aa8a2df50dc3b713602c589e6bccecdef27230ee6cb800259bf275dbd052beff03da3 SHA512 ba320e8cb56b58066a44162c8a176d167b4a05a760451a0e0821969cd2ad8fff50e54d54ec8f8c4f93ee1a2e3e71467c7c2d6d94c593ec21892e7d03fdf7c50d +AUX cffi-1.15.1-py312.patch 9546 BLAKE2B 877a82b69ff99a523ff1b392b52d1d115643a320558233cb6cd95fefb3b3dfcd0ad4dfa593c4425ad35eeec4fdedc81f5fa2f125748542263ab7933a492fa2f0 SHA512 0f472dcb4c7d51edfa168546ed17b45c68eb113071f20e536afca66ed675df4d7e8558f5912663dfe3ad65d415a9f302576b52f0d19d9399223b58768fff37ae AUX cffi-1.15.1-python3.11-tests.patch 3023 BLAKE2B e25bd9d22b81187b0eab65073930980a2975eec3086462396cfc4796fd5273edab9af2324884c2e55880825ddd046b7ebc5054adfe57574ee691f0fa2145dcd2 SHA512 4d202f8c943bf33ea359f47aa3e53e007bc3dbeb3320a6efa302b1b1ec309b2dde72f6cfe1a591c594f3321ed5c65d61e9f79a03ba3107cd7008699686719497 DIST cffi-1.15.1-drop-deprecated-py.patch.xz 31244 BLAKE2B 7c8a6ca1166335fbd385de35ebb636f21049a4dd9c52171ec58da08a61dc64c271b4afa2d69bf8b877a8c9747dfae6a8529615bbed69f5a8ab30ba5fc99c61f4 SHA512 9aba4b172b070a1a1719de2c35667abe4c7b27208b8ca3ecbf90bf168ed694f4524154e69fada5ff6f141a94b8a438db16239ba353fa9914b318b77e41dfd920 DIST cffi-1.15.1.tar.gz 508501 BLAKE2B accc317385d9af7dbed3397afde63fbab63bfc935376d951802055c63796863ed102a940f192789924480b9b16751c8cf3d21caf9b262c479c61ffc977aac83c SHA512 e99cafcb029076abc29e435b490fa0573ee2856f4051b7ca8a5b38cd125d56dd9dae8b189f59ceb3d728a675da8ee83239e09e19f8b0feeddea4b186ab5173a5 EBUILD cffi-1.15.1-r2.ebuild 1938 BLAKE2B 3ab689552ebe47e7631b3ed254cd2bc55d2a9836cb228e5a49c894f5d84ac52a37de06ab82b6172aa323025cf72f6126445eba39b210f511240943bec521a60e SHA512 6cd316d2b76c0940b339f6236e2e1f4592b0935668c6b0193ab40bd3a90f239f555a20b54fd15b0f2e9c8a98396f664741f5ea4077db283e6465ef61fb1b8cc6 +EBUILD cffi-1.15.1-r3.ebuild 2081 BLAKE2B 6d258c7870c9ea91b8fd4e5ffcd61b526999b245901ff2ca03b116f595a83d26a32cd930e1bd41ca88c78246440c8b6f36cdb94c1204040a8a7914e9f1ff862a SHA512 3dea06e4d1cd32c9eeafb6d93418ef70235879bf5a6f3538bde8789de12294ff0c297049474150987bfa45deaf3eced6ba95be7f8cf4b8c71a9a6f1ea836d06c MISC metadata.xml 318 BLAKE2B f914459fac4ae3d8ac9273fb721c52494513b932676f570f02cc4cfb2283705d8cfc761806ffed23c6f31c95a967398edee01c1536547c1830def5ca4144c003 SHA512 ec451f8c535f0d01dc7bcd248c002745947982cd469a02ac247d0d34f4d7a33374fa10c28d8f074932f0548dc500c3270b499dd08b18acbb9d308777bcc7e4f0 diff --git a/dev-python/cffi/cffi-1.15.1-r3.ebuild b/dev-python/cffi/cffi-1.15.1-r3.ebuild new file mode 100644 index 000000000000..6c093945c628 --- /dev/null +++ b/dev-python/cffi/cffi-1.15.1-r3.ebuild @@ -0,0 +1,81 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# please keep this ebuild at EAPI 8 -- sys-apps/portage dep +EAPI=8 + +# py3.12 support is experimental, expect problems in revdeps +DISTUTILS_EXT=1 +DISTUTILS_USE_PEP517=setuptools +# DO NOT ADD pypy to PYTHON_COMPAT +# pypy bundles a modified version of cffi. Use python_gen_cond_dep instead. +PYTHON_COMPAT=( python3_{10..12} ) + +inherit distutils-r1 toolchain-funcs pypi + +DESCRIPTION="Foreign Function Interface for Python calling C code" +HOMEPAGE=" + https://cffi.readthedocs.io/ + https://pypi.org/project/cffi/ +" +SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-drop-deprecated-py.patch.xz" + +LICENSE="MIT" +SLOT="0/${PV}" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris" + +# Needs recent libffi for HPPA fixes +DEPEND=" + >=dev-libs/libffi-3.4.4-r1:= +" +# setuptools as a modern distutils provider +RDEPEND=" + ${DEPEND} + dev-python/pycparser[${PYTHON_USEDEP}] + dev-python/setuptools[${PYTHON_USEDEP}] +" +BDEPEND=" + ${RDEPEND} + virtual/pkgconfig +" + +distutils_enable_sphinx doc/source +distutils_enable_tests pytest + +PATCHES=( + "${FILESDIR}"/cffi-1.14.0-darwin-no-brew.patch + "${FILESDIR}"/${P}-hppa.patch + "${FILESDIR}"/${P}-python3.11-tests.patch + "${WORKDIR}"/${P}-drop-deprecated-py.patch + "${FILESDIR}"/${P}-py312.patch +) + +src_prepare() { + if [[ ${CHOST} == *darwin* ]] ; then + # Don't obsessively try to find libffi + sed -i -e "s/.*\-iwithsysroot\/usr\/include\/ffi.*/\tpass/" setup.py || die + fi + distutils-r1_src_prepare +} + +src_configure() { + tc-export PKG_CONFIG +} + +python_test() { + local EPYTEST_IGNORE=( + # these tests call pip + testing/cffi0/test_zintegration.py + ) + local EPYTEST_DESELECT=() + if [[ ${EPYTHON} == python3.12 ]]; then + EPYTEST_DESELECT+=( + # TODO: these tests hang + testing/embedding + ) + fi + + "${EPYTHON}" -c "import _cffi_backend as backend" || die + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 + epytest c testing +} diff --git a/dev-python/cffi/files/cffi-1.15.1-py312.patch b/dev-python/cffi/files/cffi-1.15.1-py312.patch new file mode 100644 index 000000000000..a5477d686dd7 --- /dev/null +++ b/dev-python/cffi/files/cffi-1.15.1-py312.patch @@ -0,0 +1,247 @@ +diff -r 79b97f01064f cffi/vengine_cpy.py +--- a/cffi/vengine_cpy.py Thu Feb 23 05:42:01 2023 +0100 ++++ b/cffi/vengine_cpy.py Sat May 27 11:03:01 2023 +0200 +@@ -1,10 +1,16 @@ + # + # DEPRECATED: implementation for ffi.verify() + # +-import sys, imp ++import sys + from . import model + from .error import VerificationError + ++if sys.version_info >= (3, 12): ++ import importlib.machinery ++ import importlib.util ++else: ++ import imp ++ + + class VCPythonEngine(object): + _class_key = 'x' +@@ -20,16 +26,22 @@ + pass + + def find_module(self, module_name, path, so_suffixes): +- try: +- f, filename, descr = imp.find_module(module_name, path) +- except ImportError: +- return None +- if f is not None: +- f.close() ++ if sys.version_info >= (3, 12): ++ spec = importlib.machinery.PathFinder.find_spec(module_name, path) ++ if spec is None: ++ return None ++ filename = spec.origin ++ else: ++ try: ++ f, filename, descr = imp.find_module(module_name, path) ++ except ImportError: ++ return None ++ if f is not None: ++ f.close() + # Note that after a setuptools installation, there are both .py + # and .so files with the same basename. The code here relies on + # imp.find_module() locating the .so in priority. +- if descr[0] not in so_suffixes: ++ if not filename.endswith(tuple(so_suffixes)): + return None + return filename + +@@ -145,15 +157,23 @@ + def load_library(self, flags=None): + # XXX review all usages of 'self' here! + # import it as a new extension module +- imp.acquire_lock() ++ if sys.version_info < (3, 12): ++ imp.acquire_lock() + try: + if hasattr(sys, "getdlopenflags"): + previous_flags = sys.getdlopenflags() + try: + if hasattr(sys, "setdlopenflags") and flags is not None: + sys.setdlopenflags(flags) +- module = imp.load_dynamic(self.verifier.get_module_name(), +- self.verifier.modulefilename) ++ if sys.version_info >= (3, 12): ++ spec = importlib.util.spec_from_file_location( ++ self.verifier.get_module_name(), ++ self.verifier.modulefilename) ++ module = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(module) ++ else: ++ module = imp.load_dynamic(self.verifier.get_module_name(), ++ self.verifier.modulefilename) + except ImportError as e: + error = "importing %r: %s" % (self.verifier.modulefilename, e) + raise VerificationError(error) +@@ -161,7 +181,8 @@ + if hasattr(sys, "setdlopenflags"): + sys.setdlopenflags(previous_flags) + finally: +- imp.release_lock() ++ if sys.version_info < (3, 12): ++ imp.release_lock() + # + # call loading_cpy_struct() to get the struct layout inferred by + # the C compiler +diff -r 79b97f01064f testing/cffi0/test_verify.py +--- a/testing/cffi0/test_verify.py Thu Feb 23 05:42:01 2023 +0100 ++++ b/testing/cffi0/test_verify.py Sat May 27 11:03:01 2023 +0200 +@@ -1575,10 +1575,16 @@ + def test_callback_in_thread(): + if sys.platform == 'win32': + pytest.skip("pthread only") +- import os, subprocess, imp ++ import os, subprocess + arg = os.path.join(os.path.dirname(__file__), 'callback_in_thread.py') +- g = subprocess.Popen([sys.executable, arg, +- os.path.dirname(imp.find_module('cffi')[1])]) ++ if sys.version_info >= (3, 12): ++ import importlib.util ++ spec = importlib.util.find_spec('cffi') ++ cffi_path = os.path.dirname(spec.origin) ++ else: ++ import imp ++ cffi_path = imp.find_module('cffi')[1] ++ g = subprocess.Popen([sys.executable, arg, os.path.dirname(cffi_path)]) + result = g.wait() + assert result == 0 + +diff -r 79b97f01064f testing/cffi0/test_zdistutils.py +--- a/testing/cffi0/test_zdistutils.py Thu Feb 23 05:42:01 2023 +0100 ++++ b/testing/cffi0/test_zdistutils.py Sat May 27 11:03:01 2023 +0200 +@@ -1,8 +1,9 @@ +-import sys, os, imp, math, shutil ++import sys, os, math, shutil + import pytest + from cffi import FFI, FFIError + from cffi.verifier import Verifier, _locate_engine_class, _get_so_suffixes + from cffi.ffiplatform import maybe_relative_path ++from testing.support import load_dynamic + from testing.udir import udir + + +@@ -80,7 +81,7 @@ + v.compile_module() + assert v.get_module_name().startswith('_cffi_') + if v.generates_python_module(): +- mod = imp.load_dynamic(v.get_module_name(), v.modulefilename) ++ mod = load_dynamic(v.get_module_name(), v.modulefilename) + assert hasattr(mod, '_cffi_setup') + + def test_compile_module_explicit_filename(self): +@@ -95,7 +96,7 @@ + assert filename == v.modulefilename + assert v.get_module_name() == basename + if v.generates_python_module(): +- mod = imp.load_dynamic(v.get_module_name(), v.modulefilename) ++ mod = load_dynamic(v.get_module_name(), v.modulefilename) + assert hasattr(mod, '_cffi_setup') + + def test_name_from_checksum_of_cdef(self): +diff -r 79b97f01064f testing/cffi1/test_new_ffi_1.py +--- a/testing/cffi1/test_new_ffi_1.py Thu Feb 23 05:42:01 2023 +0100 ++++ b/testing/cffi1/test_new_ffi_1.py Sat May 27 11:03:01 2023 +0200 +@@ -1,5 +1,5 @@ + import pytest +-import platform, imp ++import platform + import sys, os, ctypes + import cffi + from testing.udir import udir +@@ -91,7 +91,7 @@ + + outputfilename = recompile(ffi1, "test_new_ffi_1", CCODE, + tmpdir=str(udir)) +- module = imp.load_dynamic("test_new_ffi_1", outputfilename) ++ module = load_dynamic("test_new_ffi_1", outputfilename) + ffi = module.ffi + construction_params = (ffi1, CCODE) + +@@ -1619,8 +1619,8 @@ + ffi2 = cffi.FFI(); ffi2.cdef(CDEF2) + outputfilename = recompile(ffi2, "test_multiple_independent_structs", + CDEF2, tmpdir=str(udir)) +- module = imp.load_dynamic("test_multiple_independent_structs", +- outputfilename) ++ module = load_dynamic("test_multiple_independent_structs", ++ outputfilename) + ffi1 = module.ffi + foo1 = ffi1.new("struct ab *", [10]) + foo2 = ffi .new("struct ab *", [20, 30]) +@@ -1635,8 +1635,8 @@ + outputfilename = recompile(ffi2, + "test_include_struct_union_enum_typedef", + CCODE, tmpdir=str(udir)) +- module = imp.load_dynamic("test_include_struct_union_enum_typedef", +- outputfilename) ++ module = load_dynamic("test_include_struct_union_enum_typedef", ++ outputfilename) + ffi2 = module.ffi + # + p = ffi2.new("struct nonpacked *", [b'A', -43141]) +@@ -1783,7 +1783,7 @@ + "int myfunc(int x) { return x + 1; }\n" + "int myvar = -5;\n" + "#define MYFOO 42", tmpdir=str(udir)) +- imp.load_dynamic("_test_import_from_lib", outputfilename) ++ load_dynamic("_test_import_from_lib", outputfilename) + from _test_import_from_lib.lib import myfunc, myvar, MYFOO + assert MYFOO == 42 + assert myfunc(43) == 44 +diff -r 79b97f01064f testing/support.py +--- a/testing/support.py Thu Feb 23 05:42:01 2023 +0100 ++++ b/testing/support.py Sat May 27 11:03:01 2023 +0200 +@@ -1,5 +1,11 @@ + import sys, os + ++if sys.version_info >= (3, 12): ++ import importlib.util ++else: ++ import imp ++ ++ + if sys.version_info < (3,): + __all__ = ['u', 'arraytostring'] + +@@ -16,7 +22,7 @@ + return a.tostring() + + else: +- __all__ = ['u', 'unicode', 'long', 'arraytostring'] ++ __all__ = ['u', 'unicode', 'long', 'arraytostring', 'load_dynamic'] + u = "" + unicode = str + long = int +@@ -71,15 +77,27 @@ + def getvalue(self): + return self._value + ++ ++def load_dynamic(module_name, outputfilename): ++ if sys.version_info >= (3, 12): ++ import importlib.util ++ spec = importlib.util.spec_from_file_location(module_name, ++ outputfilename) ++ module = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(module) ++ return module ++ else: ++ return imp.load_dynamic(module_name, outputfilename) ++ ++ + def _verify(ffi, module_name, preamble, *args, **kwds): +- import imp + from cffi.recompiler import recompile + from .udir import udir + assert module_name not in sys.modules, "module name conflict: %r" % ( + module_name,) + kwds.setdefault('tmpdir', str(udir)) + outputfilename = recompile(ffi, module_name, preamble, *args, **kwds) +- module = imp.load_dynamic(module_name, outputfilename) ++ module = load_dynamic(module_name, outputfilename) + # + # hack hack hack: copy all *bound methods* from module.ffi back to the + # ffi instance. Then calls like ffi.new() will invoke module.ffi.new(). -- cgit v1.2.3