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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

The imp module is removed with Python 3.12 #221

Open
dvzrv opened this issue Feb 26, 2024 · 0 comments 路 May be fixed by #222
Open

The imp module is removed with Python 3.12 #221

dvzrv opened this issue Feb 26, 2024 · 0 comments 路 May be fixed by #222

Comments

@dvzrv
Copy link

dvzrv commented Feb 26, 2024

Hi! 馃憢

I'm currently going through projects that are still using the imp module for our upcoming Python 3.12 rebuild on Arch Linux.

This project still relies on the imp module:

paver/bootstrap.py

Lines 1040 to 1069 in e71a735

def copy_required_modules(dst_prefix, symlink):
import imp
for modname in REQUIRED_MODULES:
if modname in sys.builtin_module_names:
logger.info("Ignoring built-in bootstrap module: %s" % modname)
continue
try:
f, filename, _ = imp.find_module(modname)
except ImportError:
logger.info("Cannot import bootstrap module: %s" % modname)
else:
if f is not None:
f.close()
# special-case custom readline.so on OS X, but not for pypy:
if modname == 'readline' and sys.platform == 'darwin' and not (
is_pypy or filename.endswith(join('lib-dynload', 'readline.so'))):
dst_filename = join(dst_prefix, 'lib', 'python%s' % sys.version[:3], 'readline.so')
elif modname == 'readline' and sys.platform == 'win32':
# special-case for Windows, where readline is not a
# standard module, though it may have been installed in
# site-packages by a third-party package
pass
else:
dst_filename = change_prefix(filename, dst_prefix)
copyfile(filename, dst_filename, symlink)
if filename.endswith('.pyc'):
pyfile = filename[:-1]
if os.path.exists(pyfile):
copyfile(pyfile, dst_filename[:-1], symlink)

The imp module is removed with Python 3.12 and this project needs to be migrated to use importlib instead:
https://docs.python.org/dev/whatsnew/3.12.html#imp

@cybaol cybaol linked a pull request Mar 1, 2024 that will close this issue
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.

1 participant