From: Gabe Black Date: Thu, 26 Mar 2020 10:38:14 +0000 (-0700) Subject: scons: Replace find_first_prog() with the built in Detect(). X-Git-Tag: v20.0.0.0~245 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=55ae5a886b0a2a9529742d0466856ef5c0dc34a1;p=gem5.git 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 Maintainer: Bobby R. Bruce Tested-by: kokoro --- diff --git a/SConstruct b/SConstruct index 4273d147f..f5eb0ca63 100755 --- a/SConstruct +++ b/SConstruct @@ -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'])