git: 6254b6baa059 - main - devel/py-pep562: Fix build with Python 3.12+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 Jun 2026 20:50:40 UTC
The branch main has been updated by sunpoet:
URL: https://cgit.FreeBSD.org/ports/commit/?id=6254b6baa0596b695cb77a567c0aeb0bddf4a0fc
commit 6254b6baa0596b695cb77a567c0aeb0bddf4a0fc
Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2026-06-26 20:44:53 +0000
Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2026-06-26 20:44:53 +0000
devel/py-pep562: Fix build with Python 3.12+
* Getting build dependencies for wheel...
Traceback (most recent call last):
...
File "setup.py", line 6, in <module>
import imp
ModuleNotFoundError: No module named 'imp'
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
*** Error code 1
Reference: https://pkg-status.freebsd.org/beefy23/data/150amd64-default/92a0eb6f0ba2/logs/py312-pep562-1.1_1.log
---
devel/py-pep562/files/patch-setup.py | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/devel/py-pep562/files/patch-setup.py b/devel/py-pep562/files/patch-setup.py
new file mode 100644
index 000000000000..8372f7622e14
--- /dev/null
+++ b/devel/py-pep562/files/patch-setup.py
@@ -0,0 +1,30 @@
+--- setup.py.orig 2021-05-21 16:12:34 UTC
++++ setup.py
+@@ -3,7 +3,7 @@ import os
+
+ from setuptools import setup, find_packages
+ import os
+-import imp
++import importlib
+ import traceback
+
+
+@@ -11,14 +11,14 @@ def get_version():
+ """Get version and version_info without importing the entire module."""
+
+ path = os.path.join(os.path.dirname(__file__), 'pep562')
+- fp, pathname, desc = imp.find_module('__init__', [path])
++ pathname = os.path.join(path, '__init__.py')
+ try:
+- module = imp.load_module('__init__', fp, pathname, desc)
++ spec = importlib.util.spec_from_file_location('pep562', pathname)
++ module = importlib.util.module_from_spec(spec)
++ spec.loader.exec_module(module)
+ return module.__version__, module.__version_info__._get_dev_status()
+ except Exception:
+ print(traceback.format_exc())
+- finally:
+- fp.close()
+
+
+ def get_requirements(req):