Better option - strip just the extension.

This commit is contained in:
Tommaso Pecorella
2020-08-31 19:09:35 +02:00
committed by Tommaso Pecorella
parent 6c60648d42
commit 52d6f390ef

View File

@@ -178,14 +178,13 @@ def get_run_program(program_string, command_template=None):
argv = shlex.split(program_string)
#print "%r ==shlex.split==> %r" % (program_string, argv)
program_name = argv[0]
# if the script name ends with .cc - strip it
if program_name.endswith('.cc'):
program_name = program_name.rsplit('.', 1)[0]
try:
program_obj = find_program(program_name, env)
except ValueError as ex:
pass # try if the use passed the whole script name (i.e., including the '.cc' at the end)
try:
program_name = program_name.replace('.cc', '')
program_obj = find_program(program_name, env)
except ValueError as ex:
raise WafError(str(ex))
@@ -200,13 +199,13 @@ def get_run_program(program_string, command_template=None):
else:
program_name = program_string
# if the script name ends with .cc - strip it
if program_name.endswith('.cc'):
program_name = program_name.rsplit('.', 1)[0]
try:
program_obj = find_program(program_name, env)
except ValueError as ex:
pass # try if the use passed the whole script name (i.e., including the '.cc' at the end)
try:
program_name = program_name.replace('.cc', '')
program_obj = find_program(program_name, env)
except ValueError as ex:
raise WafError(str(ex))