From 57b555b5fe2e8ab8d97cf6eee4d471b8c567bf9c Mon Sep 17 00:00:00 2001 From: Anthony Baire Date: Wed, 10 Oct 2012 11:00:44 +0200 Subject: [PATCH] allow using the flex shipped with MSYS (it expects path separated by / instead of \) Signed-off-by: Thomas Nagy --- waflib/Tools/flex.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/waflib/Tools/flex.py b/waflib/Tools/flex.py index b3b46bd8..892482e4 100644 --- a/waflib/Tools/flex.py +++ b/waflib/Tools/flex.py @@ -8,7 +8,7 @@ The **flex** program is a code generator which creates C or C++ files. The generated files are compiled into object files. """ -import waflib.TaskGen +import waflib.TaskGen, os, re def decide_ext(self, node): if 'cxx' in self.features: @@ -25,7 +25,10 @@ def flexfun(tsk): tsk.last_cmd = lst = [] lst.extend(to_list(env['FLEX'])) lst.extend(to_list(env['FLEXFLAGS'])) - lst.extend([a.path_from(bld.bldnode) for a in tsk.inputs]) + inputs = [a.path_from(bld.bldnode) for a in tsk.inputs] + if env.FLEX_MSYS: + inputs = [x.replace(os.sep, '/') for x in inputs] + lst.extend(inputs) lst = [x for x in lst if x] txt = bld.cmd_and_log(lst, cwd=wd, env=env.env or None, quiet=0) tsk.outputs[0].write(txt.replace('\r\n', '\n').replace('\r', '\n')) # issue #1207 @@ -44,3 +47,6 @@ def configure(conf): conf.find_program('flex', var='FLEX') conf.env.FLEXFLAGS = ['-t'] + if re.search (r"\\msys\\[0-9.]+\\bin\\flex.exe$", conf.env.FLEX): + # this is the flex shipped with MSYS + conf.env.FLEX_MSYS = True