-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
17.0.4: LLVM uses deprecated distutils
python module
#54337
Comments
@llvm/issue-subscribers-lldb |
Just checked 14.0.0 and still I see used [tkloczko@devel-g2v lldb-14.0.0.src]$ grep -r distutils
packages/Python/lldbsuite/test/decorators.py:from distutils.version import LooseVersion
packages/Python/lldbsuite/test/lldbtest.py:from distutils.version import LooseVersion
packages/Python/lldbsuite/test/lldbtest.py:import distutils.spawn
packages/Python/lldbsuite/test/lldbtest.py: path = distutils.spawn.find_executable("clang", lldb_dir)
test/API/tools/lldb-server/TestAppleSimulatorOSType.py: from distutils.version import LooseVersion
test/Shell/helper/build.py: from distutils.version import StrictVersion
test/Shell/helper/build.py: from distutils.version import LooseVersion
test/Shell/lit.cfg.py:from distutils.spawn import find_executable
third_party/Python/module/pexpect-4.6/setup.py:from distutils.core import setup |
distutils
distutils
To remove |
distutils is deprecated and shutil.which is the suggested replacement for this function. https://peps.python.org/pep-0632/#migration-advice https://docs.python.org/3/library/shutil.html#shutil.which It was added in Python3.3 but given that we're already using shutil.which elsewhere I think this is ok/no worse than before. We do have our own find_executable in lldb/test/Shell/helper/build.py but I'd rather leave that as is for now. Also we have our own versions of which() but again, a change for another time. This work is part of #54337. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D124601
https://reviews.llvm.org/D124670 is what switching to Needs testing on all platforms though, I'm not sure Then we'd be left with:
Which could be updated if we want. I think it is used just for the test suite not any modules you would find in an install. |
Only confirmation: lldb seems is no longer affected. |
No longer affected how exactly. In that we've removed all the distutils usage that isn't related just to testing? I'd keep this open just for removing distutils usage in general, testing or otherwise. |
Current |
Ok I understand now. I think (in that I've never seen it written down) the policy for lldb is to include copies of third party python packages. So to be clear by "updated" I mean getting a copy of a newer version of pexpect, not editing the current one to remove distutils. When I get a chance I'll find out what that process looks like. We do have to be careful about API changes there. |
It's not just lldb -- llvm in general likes to absorb things into its repository. Although I don't really agree with the practice, I can't deny the practicality of not having to install a bunch of random packages in order to run tests. On a practical note, our copy of pexpect was updated fairly recently, and we don't make any modifications to it, so pulling in a new version should be fairly straight-forward. |
@DavidSpickett, would you by any chance be interested in doing the I'm wondering about the best replacement for That said, I suppose most of |
I don't see why not. I see 22 instances of Do you have the time to do patches or should I? |
I would prefer if you did it. I have time to write patches but unfortunately insufficient time to test them properly ;-). |
https://reviews.llvm.org/D148522 After those the only |
Thank you! |
All the above have landed, everything uses As for Unfortunately I won't have time to look into this myself. |
Note that |
Yeah I feared it might not be 100% the same. It might be best to write up a small set of tests that mimic what the existing users in llvm-project are doing. Then see if any of the alternatives fit, otherwise we could make a small module to do just what we need. |
Yeah, I'll try to find some time for it. No promises, though. |
Just checked 16.x brancj and looks like [tkloczko@pers-jacek llvm-project]$ grep -r distutils | grep py:
clang/utils/check_cfc/setup.py:from distutils.core import setup
clang/utils/creduce-clang-crash.py:from distutils.spawn import find_executable
compiler-rt/lib/asan/scripts/asan_symbolize.py:from distutils.spawn import find_executable
compiler-rt/test/lit.common.cfg.py: from distutils.version import LooseVersion
cross-project-tests/lit.cfg.py:from distutils.version import LooseVersion
libcxx/utils/libcxx/sym_check/extract.py:import distutils.spawn
libcxx/utils/libcxx/sym_check/extract.py: return distutils.spawn.find_executable('nm')
libcxx/utils/libcxx/sym_check/extract.py: return distutils.spawn.find_executable('readelf')
libcxx/utils/libcxx/sym_check/extract.py: return distutils.spawn.find_executable('dump')
libcxx/utils/libcxx/sym_check/util.py:import distutils.spawn
libcxx/utils/libcxx/sym_check/util.py:_cppfilt_exe = distutils.spawn.find_executable('c++filt')
lldb/packages/Python/lldbsuite/test/decorators.py:from distutils.version import LooseVersion
lldb/packages/Python/lldbsuite/test/lldbtest.py:from distutils.version import LooseVersion
lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py: from distutils.version import LooseVersion
lldb/test/Shell/helper/build.py: from distutils.version import StrictVersion
lldb/test/Shell/helper/build.py: from distutils.version import LooseVersion
lldb/third_party/Python/module/pexpect-4.6/setup.py:from distutils.core import setup
llvm/utils/gn/build/write_vcsrevision.py: # distutils.spawn.which() doesn't find .bat files,
llvm/utils/release/bump-version.py: # parse the version string with distutils.
third-party/benchmark/setup.py:from distutils import sysconfig |
distutils
distutils
python module
Just FTR updated list of files which are still using clang/utils/check_cfc/setup.py:from distutils.core import setup
compiler-rt/test/lit.common.cfg.py: from distutils.version import LooseVersion
cross-project-tests/lit.cfg.py:from distutils.version import LooseVersion
libcxx/utils/ci/Dockerfile:#RUN apt-get update && apt-get install -y ninja-build python3 python3-distutils python3-psutil git gdb ccache
libcxx/utils/ci/Dockerfile:RUN apt-get update && apt-get install -y python3 python3-distutils python3-psutil git gdb ccache
lldb/packages/Python/lldbsuite/test/decorators.py:from distutils.version import LooseVersion
lldb/packages/Python/lldbsuite/test/lldbtest.py:from distutils.version import LooseVersion
lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py: from distutils.version import LooseVersion
lldb/test/Shell/helper/build.py: from distutils.version import StrictVersion
lldb/test/Shell/helper/build.py: from distutils.version import LooseVersion
lldb/third_party/Python/module/pexpect-4.6/setup.py:from distutils.core import setup
llvm/utils/gn/build/write_vcsrevision.py: # distutils.spawn.which() doesn't find .bat files,
llvm/utils/release/bump-version.py: # parse the version string with distutils.
third-party/benchmark/setup.py:from distutils import sysconfig |
distutils
python moduledistutils
python module
Any progress? 🤔 |
Surprisingly, yes :) 0c02329 As of now:
|
From of the pan into the open fire .. |
Looks like use of [tkloczko@pers-jacek llvm-project]$ git grep distutils
clang/utils/check_cfc/setup.py:from distutils.core import setup
compiler-rt/test/lit.common.cfg.py: from distutils.version import LooseVersion
cross-project-tests/lit.cfg.py:from distutils.version import LooseVersion
libcxx/utils/ci/Dockerfile: python3-distutils \
libcxx/utils/ci/Dockerfile:#RUN apt-get update && apt-get install -y ninja-build python3 python3-distutils python3-psutil git gdb ccache
lldb/test/Shell/helper/build.py: from distutils.version import StrictVersion
lldb/third_party/Python/module/pexpect-4.6/setup.py:from distutils.core import setup
llvm/utils/gn/build/write_vcsrevision.py: # distutils.spawn.which() doesn't find .bat files,
llvm/utils/release/bump-version.py: # parse the version string with distutils. |
PR to use packaging instead of pkg_resources: #93712 |
distutils
is already deprecated https://peps.python.org/pep-0632/ and should no longer be used.The text was updated successfully, but these errors were encountered: