2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 19:30:04 +01:00

Revert "Issue 1334 - let FOO_ST:FOO return empty when FOO_ST is empty/undefined"

This reverts commit d4d33bba2a.

It breaks demos/c
This commit is contained in:
Jerome Carretero 2013-07-20 14:57:20 -04:00
parent edf26656ab
commit 3c00a614d7

View File

@ -337,24 +337,14 @@ class TaskBase(evil):
def colon(self, var1, var2):
"""
Support code for scriptlet expressions such as ${FOO_ST:FOO}
If the first variable (FOO_ST) is empty, then an empty list is returned
private function for the moment
The results will be slightly different if FOO_ST is a list, for example::
env.FOO_ST = ['-a', '-b']
env.FOO_ST = '-I%s'
# ${FOO_ST:FOO} returns
['-Ip1', '-Ip2']
env.FOO = ['p1', 'p2']
# ${FOO_ST:FOO} returns
['-a', '-b', 'p1', '-a', '-b', 'p2']
used for scriptlet expressions such as ${FOO_ST:FOO}, for example, if
env.FOO_ST = ['-a', '-b']
env.FOO = ['1', '2']
then the result will be ['-a', '-b', '1', '-a', '-b', '2']
"""
tmp = self.env[var1]
if not tmp:
return
if isinstance(var2, str):
it = self.env[var2]
else:
@ -362,6 +352,8 @@ class TaskBase(evil):
if isinstance(tmp, str):
return [tmp % x for x in it]
else:
if Logs.verbose and not tmp and it:
Logs.warn('Missing env variable %r for task %r (generator %r)' % (var1, self, self.generator))
lst = []
for y in it:
lst.extend(tmp)