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 module distutils is deprecated, consider replacing it #9289

Open
stevapple opened this issue Sep 19, 2024 · 0 comments
Open

Python module distutils is deprecated, consider replacing it #9289

stevapple opened this issue Sep 19, 2024 · 0 comments

Comments

@stevapple
Copy link

stevapple commented Sep 19, 2024

lldb/bindings/python/prepare_binding_python.py imports distutils which used to be a part of Python standard libraries, but was deprecated long ago and finally removed in Python 3.12. Thus we'll get the following error if we tried to build with a vallina Python 3.12 install:

FAILED: tools/lldb/bindings/python/LLDBWrapPython.cpp tools/lldb/bindings/python/lldb.py E:/swift-build/5/tools/lldb/bindings/python/LLDBWrapPython.cpp E:/swift-build/5/tools/lldb/bindings/python/lldb.py
C:\Windows\system32\cmd.exe /C "cd /D E:\swift-build\5\tools\lldb\bindings\python && E:\swift-build\python\3.12.6\amd64\Python312\python.exe C:/Users/stevapple/Developer/llvm-project/lldb/bindings/prepare_bindings.py --srcRoot=C:/Users/stevapple/Developer/llvm-project/lldb --buildRoot=E:/swift-build/5/tools/lldb --targetDir=E:/swift-build/5/tools/lldb/bindings/python --cfgBldDir=E:/swift-build/5/tools/lldb/bindings/python --prefix=E:/swift-build/5 --use-static-binding"
Traceback (most recent call last):
  File "C:\Users\stevapple\Developer\llvm-project\lldb\bindings\prepare_bindings.py", line 290, in <module>
    main(sys.argv[1:])
  File "C:\Users\stevapple\Developer\llvm-project\lldb\bindings\prepare_bindings.py", line 285, in main
    prepare_all_bindings(options)
  File "C:\Users\stevapple\Developer\llvm-project\lldb\bindings\prepare_bindings.py", line 74, in prepare_all_bindings
    prepare_binding_for_language(bindings_dir, script_lang, options)
  File "C:\Users\stevapple\Developer\llvm-project\lldb\bindings\prepare_bindings.py", line 49, in prepare_binding_for_language
    module.main(options)
  File "c:\users\stevapple\developer\llvm-project\lldb\bindings\python\prepare_binding_python.py", line 443, in main
    python_module_path = get_python_module_path(options)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\users\stevapple\developer\llvm-project\lldb\bindings\python\prepare_binding_python.py", line 369, in get_python_module_path
    from distutils.sysconfig import get_python_lib
ModuleNotFoundError: No module named 'distutils'
ninja: build stopped: subcommand failed.

We should consider replacing it with a modernized module, though they're most likely not included in the standard libraries

FYI Upstream LLVM's choice was packaging.

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

No branches or pull requests

1 participant