This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Use shutil.which instead of distutils find_executable
ClosedPublic

Authored by DavidSpickett on Apr 28 2022, 2:17 AM.

Details

Summary

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.

Diff Detail

Event Timeline

DavidSpickett created this revision.Apr 28 2022, 2:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2022, 2:17 AM
DavidSpickett requested review of this revision.Apr 28 2022, 2:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2022, 2:17 AM

https://reviews.llvm.org/D124429 unblocked doing this.

The github issue is https://github.com/llvm/llvm-project/issues/54337.

Once I know this is ok with the bots I'll see what I can do about our various which re-implementations (I'm sure they have quirks that are easy to miss).

This revision is now accepted and ready to land.Apr 28 2022, 8:41 AM