scons: Replace find_first_prog() with the built in Detect().

The built in environment method Detect() does the same thing, that is it
finds the first program available from a list of options.

Change-Id: I3763ae5cc9dd22ee322908c0a7a2c037dc91d5a5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27126
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2020-03-26 03:38:14 -07:00
committed by Gabe Black
parent b5a3c0de7e
commit 55ae5a886b

View File

@@ -214,19 +214,6 @@ def makePathListAbsolute(path_list, root=GetLaunchDir()):
return [abspath(joinpath(root, expanduser(str(p))))
for p in path_list]
def find_first_prog(prog_names):
"""Find the absolute path to the first existing binary in prog_names"""
if not isinstance(prog_names, (list, tuple)):
prog_names = [ prog_names ]
for p in prog_names:
p = main.WhereIs(p)
if p is not None:
return p
return None
# Each target must have 'build' in the interior of the path; the
# directory below this will determine the build parameters. For
# example, for target 'foo/bar/build/X86/arch/x86/blah.do' we
@@ -679,7 +666,7 @@ if main['USE_PYTHON']:
# version of python, see above for instructions on how to invoke
# scons with the appropriate PATH set.
python_config = find_first_prog(main['PYTHON_CONFIG'])
python_config = main.Detect(main['PYTHON_CONFIG'])
if python_config is None:
error("Can't find a suitable python-config, tried %s" % \
main['PYTHON_CONFIG'])