Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12 builds fail because imp has been deprecated and removed #41

Closed
ShadowJonathan opened this issue May 2, 2024 · 3 comments · Fixed by #44
Closed

Python 3.12 builds fail because imp has been deprecated and removed #41

ShadowJonathan opened this issue May 2, 2024 · 3 comments · Fixed by #44

Comments

@ShadowJonathan
Copy link

Title, https://docs.python.org/3.11/library/imp.html

@tseaver
Copy link

tseaver commented May 2, 2024

This patch should fix the imp error:

--- a/enscons/cpyext.py
+++ b/enscons/cpyext.py
@@ -10,8 +10,8 @@ from distutils.core import Distribution
 from distutils.extension import Extension
 from distutils.command.build_ext import build_ext
 
-import imp
 import importlib
+import importlib.machinery
 
 # not used when generate is passed directly to Environment
 def exists(env):
@@ -88,7 +88,7 @@ def get_build_ext(name="zoot"):
 # from setuptools
 def get_abi3_suffix():
     """Return the file extension for an abi3-compliant Extension()"""
-    for suffix, _, _ in (s for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION):
+    for suffix in importlib.machinery.EXTENSION_SUFFIXES:
         if ".abi3" in suffix:  # Unix
             return suffix
         elif suffix == ".pyd":  # Windows

But then enscons still wants to use distutils, which was deprecated in Python 3.10 and removed in Python 3.12 per PEP 632.

@dholth
Copy link
Owner

dholth commented Jul 20, 2024

Yes, enscons would prefer to be patched to work with Python 3.12

Too bad that we use distutils to get compiler information. Although perhaps its sauce is not that secret? (IIRC there are only a few revelant cflags)

@dholth
Copy link
Owner

dholth commented Jul 20, 2024

Thanks. Do you have time to look over the PR?

CC @tseaver @charliermarsh @richardkiss

Sometimes it seems like github prioritizes notifications from "every random project except my own".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants