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