mirror of https://gitlab.com/ita1024/waf.git
Process expressions of the form
This commit is contained in:
parent
a808d83a45
commit
62efd56628
|
@ -66,7 +66,14 @@ def build(bld):
|
|||
|
||||
bld.env.FOO =['m', 'ncurses']
|
||||
bld.env.ST = '-L%s'
|
||||
bld(rule='echo ${ST:FOO} ${ST:SRC}', always=True, source='wscript', shell=1)
|
||||
bld.env.A = 'aye'
|
||||
bld.env.B = 'doh'
|
||||
bld.env.SRCA = ['aaa']
|
||||
bld(rule='echo ${ST:FOO} ${ST:SRC} ${A}${B} ${ST:SRCA} ${ST:SRC[0].abspath()}',
|
||||
always=True, source='wscript', shell=1, name='Shell')
|
||||
if not Utils.is_win32:
|
||||
bld(rule='echo ${ST:FOO} ${ST:SRC} ${A}${B} ${ST:SRCA} ${ST:SRC[0].abspath()}',
|
||||
always=True, source='wscript', shell=0, cls_keyword=lambda x:'Trying again', name='NoShell')
|
||||
|
||||
# illustrate how to add a command 'foo' and to execute things in it
|
||||
if bld.cmd == 'foo':
|
||||
|
|
|
@ -950,6 +950,7 @@ def funex(c):
|
|||
exec(c, dc)
|
||||
return dc['f']
|
||||
|
||||
re_novar = re.compile(r"^(SRC|TGT)\W+.*?$")
|
||||
reg_act = re.compile(r"(?P<backslash>\\)|(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)
|
||||
def compile_fun_shell(line):
|
||||
"""
|
||||
|
@ -984,6 +985,10 @@ def compile_fun_shell(line):
|
|||
m = '[a.path_from(cwdx) for a in tsk.inputs]'
|
||||
elif m == 'TGT':
|
||||
m = '[a.path_from(cwdx) for a in tsk.outputs]'
|
||||
elif re_novar.match(m):
|
||||
m = '[tsk.inputs%s]' % m[3:]
|
||||
elif re_novar.match(m):
|
||||
m = '[tsk.outputs%s]' % m[3:]
|
||||
elif m[:3] not in ('tsk', 'gen', 'bld'):
|
||||
dvars.extend([var, meth[1:]])
|
||||
m = '%r' % m
|
||||
|
@ -1039,6 +1044,10 @@ def compile_fun_noshell(line):
|
|||
m = '[a.path_from(cwdx) for a in tsk.inputs]'
|
||||
elif m == 'TGT':
|
||||
m = '[a.path_from(cwdx) for a in tsk.outputs]'
|
||||
elif re_novar.match(m):
|
||||
m = '[tsk.inputs%s]' % m[3:]
|
||||
elif re_novar.match(m):
|
||||
m = '[tsk.outputs%s]' % m[3:]
|
||||
elif m[:3] not in ('tsk', 'gen', 'bld'):
|
||||
dvars.extend([var, m])
|
||||
m = '%r' % m
|
||||
|
|
Loading…
Reference in New Issue