Index: llvm/utils/update_cc_test_checks.py =================================================================== --- llvm/utils/update_cc_test_checks.py +++ llvm/utils/update_cc_test_checks.py @@ -16,11 +16,11 @@ import argparse import collections -import distutils.spawn import json import os import re import shlex +import shutil import subprocess import sys import tempfile @@ -140,6 +140,14 @@ args.opt = os.path.join(args.llvm_bin, 'opt') +def find_executable(executable): + _, ext = os.path.splitext(executable) + if sys.platform == 'win32' and ext != '.exe': + executable = executable + '.exe' + + return shutil.which(executable) + + def config(): parser = argparse.ArgumentParser( description=__doc__, @@ -167,7 +175,7 @@ args = common.parse_commandline_args(parser) infer_dependent_args(args) - if not distutils.spawn.find_executable(args.clang): + if not find_executable(args.clang): print('Please specify --llvm-bin or --clang', file=sys.stderr) sys.exit(1) @@ -183,7 +191,7 @@ common.warn('Could not determine clang builtins directory, some tests ' 'might not update correctly.') - if not distutils.spawn.find_executable(args.opt): + if not find_executable(args.opt): # Many uses of this tool will not need an opt binary, because it's only # needed for updating a test that runs clang | opt | FileCheck. So we # defer this error message until we find that opt is actually needed.