git: 31f729c0c5a6 - main - devel/py-python-ptrace: fix build with python 3.12

Mateusz Piotrowski <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch main has been updated by 0mp:

URL: https://cgit.FreeBSD.org/ports/commit/?id=31f729c0c5a628bca80e5dd885d3312cf76965e9

commit 31f729c0c5a628bca80e5dd885d3312cf76965e9
Author:     Hiroo Ono <[email protected]>
AuthorDate: 2026-07-11 14:26:21 +0000
Commit:     Mateusz Piotrowski <[email protected]>
CommitDate: 2026-08-17 14:04:17 +0000

    devel/py-python-ptrace: fix build with python 3.12
    
    PR:     296695
---
 devel/py-python-ptrace/Makefile                    |  2 +-
 devel/py-python-ptrace/files/patch-setup.py        | 27 ++++++++++++++++++++++
 .../py-python-ptrace/files/patch-setup__cptrace.py | 27 ++++++++++++++++++++++
 3 files changed, 55 insertions(+), 1 deletion(-)

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,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.