This is an archive of the discontinued LLVM Phabricator instance.

[clang] Replace find_executable with shutil.which in creduce script
ClosedPublic

Authored by DavidSpickett on Apr 17 2023, 6:41 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

which was added in 3.3 (https://docs.python.org/3/library/shutil.html#shutil.which)
and LLVM requires at least 3.6 (https://llvm.org/docs/GettingStarted.html#software).

There is one small differnce here that shutil.which ignores the PATH
when given a path argument. However in this case I think that's actually
the behaviour we want.

Diff Detail

Event Timeline

DavidSpickett created this revision.Apr 17 2023, 6:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 6:41 AM
DavidSpickett requested review of this revision.Apr 17 2023, 6:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 6:41 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
zequanwu accepted this revision.Apr 17 2023, 8:11 AM

LGTM.

This revision is now accepted and ready to land.Apr 17 2023, 8:11 AM
This revision was landed with ongoing or failed builds.Apr 17 2023, 8:33 AM
This revision was automatically updated to reflect the committed changes.