[clang] Replace find_executable with shutil.which in creduce script
authorDavid Spickett <david.spickett@linaro.org>
Mon, 17 Apr 2023 13:40:16 +0000 (13:40 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Mon, 17 Apr 2023 15:33:06 +0000 (15:33 +0000)
commitee341373625163846f4ebc68e46aec6fb46c2c09
treefdb5f2275668fc910087badd4eac4347452b9658
parent2be31896013dd316e10e6cb36321deb62d26e8f7
[clang] Replace find_executable with shutil.which in creduce script

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.

Reviewed By: zequanwu

Differential Revision: https://reviews.llvm.org/D148529
clang/utils/creduce-clang-crash.py