summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDaniel <dmoody256@gmail.com>2019-02-17 04:24:00 (GMT)
committerDaniel <dmoody256@gmail.com>2019-02-17 04:24:00 (GMT)
commit77560936fe38dccf1c4c46a2b41e3c5d4e3a0462 (patch)
treedaed891e417927e1e9fff2a55fd8ff6358f75dc0 /src/engine
parent2feb2f39ccd71cfd72f42c5f97eedbe23b5a5853 (diff)
downloadSCons-77560936fe38dccf1c4c46a2b41e3c5d4e3a0462.zip
SCons-77560936fe38dccf1c4c46a2b41e3c5d4e3a0462.tar.gz
SCons-77560936fe38dccf1c4c46a2b41e3c5d4e3a0462.tar.bz2
condensed and organized code
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Tool/lex.py32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py
index 732c0da..70c0c5f 100644
--- a/src/engine/SCons/Tool/lex.py
+++ b/src/engine/SCons/Tool/lex.py
@@ -74,26 +74,18 @@ def get_lex_path(env, append_paths=False):
"""
# save existing path to reset if we don't want to append any paths
envPath = env['ENV']['PATH']
-
- lex = SCons.Tool.find_program_path(env, 'lex', default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS )
- if lex:
- if not append_paths:
- env['ENV']['PATH'] = envPath
- else:
- lex_bin_dir = os.path.dirname(lex)
- env.AppendENVPath('PATH', lex_bin_dir)
- return lex
-
- flex = SCons.Tool.find_program_path(env, 'flex', default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS )
- if flex:
- if not append_paths:
- env['ENV']['PATH'] = envPath
- else:
- flex_bin_dir = os.path.dirname(flex)
- env.AppendENVPath('PATH', flex_bin_dir)
- return flex
- else:
- SCons.Warnings.Warning('lex tool requested, but lex or flex binary not found in ENV PATH')
+ bins = ['lex', 'flex']
+
+ for prog in bins:
+ bin_path = SCons.Tool.find_program_path(env, prog, default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS )
+ if bin_path:
+ if not append_paths:
+ env['ENV']['PATH'] = envPath
+ else:
+ env.AppendENVPath('PATH', os.path.dirname(bin_path))
+ return bin_path
+
+ SCons.Warnings.Warning('lex tool requested, but lex or flex binary not found in ENV PATH')
def generate(env):