diff options
| author | Hiroo Ono <hiroo.ono+freebsd@gmail.com> | 2026-07-11 14:26:21 +0000 |
|---|---|---|
| committer | Mateusz Piotrowski <0mp@FreeBSD.org> | 2026-08-18 09:04:25 +0000 |
| commit | 2f4fd6c6ba28109d1c4937a4ad89fb683195a9b9 (patch) | |
| tree | 40984013dc0c8f1335ffaef484750152bae0767d | |
| parent | c7edee4fe7b8744be7cec601207e11c8c4ed7e58 (diff) | |
devel/py-python-ptrace: fix build with python 3.12
PR: 296695
(cherry picked from commit 31f729c0c5a628bca80e5dd885d3312cf76965e9)
| -rw-r--r-- | devel/py-python-ptrace/Makefile | 2 | ||||
| -rw-r--r-- | devel/py-python-ptrace/files/patch-setup.py | 27 | ||||
| -rw-r--r-- | devel/py-python-ptrace/files/patch-setup__cptrace.py | 27 |
3 files changed, 55 insertions, 1 deletions
diff --git a/devel/py-python-ptrace/Makefile b/devel/py-python-ptrace/Makefile index 4a8497ea69c7..ac545482c6d8 100644 --- a/devel/py-python-ptrace/Makefile +++ b/devel/py-python-ptrace/Makefile @@ -1,6 +1,6 @@ PORTNAME= python-ptrace PORTVERSION= 0.9.8 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} diff --git a/devel/py-python-ptrace/files/patch-setup.py b/devel/py-python-ptrace/files/patch-setup.py new file mode 100644 index 000000000000..f175159d441f --- /dev/null +++ b/devel/py-python-ptrace/files/patch-setup.py @@ -0,0 +1,27 @@ +--- setup.py.orig 2021-03-17 20:17:30 UTC ++++ setup.py +@@ -28,7 +28,8 @@ + # - git commit -a -m "post-release" + # - git push + +-from imp import load_source ++import importlib.machinery ++import importlib.util + from os import path + try: + # setuptools supports bdist_wheel +@@ -55,7 +56,13 @@ with open('README.rst') as fp: + with open('README.rst') as fp: + LONG_DESCRIPTION = fp.read() + +-ptrace = load_source("version", path.join("ptrace", "version.py")) ++filepath = path.join("ptrace", "version.py") ++loader = importlib.machinery.SourceFileLoader("version", filepath) ++spec = importlib.util.spec_from_file_location( ++ "version", filepath, loader=loader) ++module = importlib.util.module_from_spec(spec) ++loader.exec_module(module) ++ptrace = module + PACKAGES = {} + for name in MODULES: + PACKAGES[name] = name.replace(".", "/") diff --git a/devel/py-python-ptrace/files/patch-setup__cptrace.py b/devel/py-python-ptrace/files/patch-setup__cptrace.py new file mode 100644 index 000000000000..a9824690d38d --- /dev/null +++ b/devel/py-python-ptrace/files/patch-setup__cptrace.py @@ -0,0 +1,27 @@ +--- setup_cptrace.py.orig 2026-07-11 13:49:49 UTC ++++ setup_cptrace.py +@@ -17,7 +17,8 @@ def main(): + + + def main(): +- from imp import load_source ++ import importlib.machinery ++ import importlib.util + from os import path + from sys import argv + +@@ -29,7 +30,13 @@ def main(): + + cptrace_ext = Extension('cptrace', sources=SOURCES) + +- cptrace = load_source("version", path.join("cptrace", "version.py")) ++ filepath = path.join("cptrace", "version.py") ++ loader = importlib.machinery.SourceFileLoader("version", filepath) ++ spec = importlib.util.spec_from_file_location( ++ "version", filepath, loader=loader) ++ module = importlib.util.module_from_spec(spec) ++ loader.exec_module(module) ++ cptrace = module + + install_options = { + "name": cptrace.PACKAGE, |
