summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2012-10-07 12:53:59 (GMT)
committerRussel Winder <russel@winder.org.uk>2012-10-07 12:53:59 (GMT)
commita3b029fc95f3d3a4ad6f891981d7d587875d0a1d (patch)
tree9f53c187a70720519f6479d544f73bab6222b583 /src
parent1f035386be2924e356d385e813703b761f3dd43b (diff)
parent46043901f7a93385e5bb2d3243073bd6c5634ca8 (diff)
downloadSCons-a3b029fc95f3d3a4ad6f891981d7d587875d0a1d.zip
SCons-a3b029fc95f3d3a4ad6f891981d7d587875d0a1d.tar.gz
SCons-a3b029fc95f3d3a4ad6f891981d7d587875d0a1d.tar.bz2
Merge in default/tip from the mainline.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/EnvironmentTests.py15
-rw-r--r--src/engine/SCons/PathList.py10
-rw-r--r--src/engine/SCons/PathListTests.py36
-rw-r--r--src/engine/SCons/Tool/xgettext.py5
5 files changed, 64 insertions, 5 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 5da66d7..84e5943 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -11,6 +11,9 @@
RELEASE 2.X.X -
+ From Alexey Klimkin:
+ - Fix nested LIBPATH expansion by flattening sequences in subst_path.
+
From eyan on Bitbucket:
- Print target name with command execution time with --debug=time
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 9237c8a..45cf876 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -1440,6 +1440,21 @@ def exists(env):
x = s("${_concat(PRE, LIST, SUF, __env__)}")
assert x == 'preasuf prebsuf', x
+ def test_concat_nested(self):
+ "Test _concat() on a nested substitution strings."
+ e = self.TestEnvironment(PRE='pre', SUF='suf',
+ L1=['a', 'b'],
+ L2=['c', 'd'],
+ L3=['$L2'])
+ x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)')
+ assert x == 'preasuf prebsuf', x
+ e.AppendUnique(L1 = ['$L2'])
+ x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)')
+ assert x == 'preasuf prebsuf precsuf predsuf', x
+ e.AppendUnique(L1 = ['$L3'])
+ x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)')
+ assert x == 'preasuf prebsuf precsuf predsuf precsuf predsuf', x
+
def test_gvars(self):
"""Test the Environment gvars() method"""
env = self.TestEnvironment(XXX = 'x', YYY = 'y', ZZZ = 'z')
diff --git a/src/engine/SCons/PathList.py b/src/engine/SCons/PathList.py
index 870c195..f3de57c 100644
--- a/src/engine/SCons/PathList.py
+++ b/src/engine/SCons/PathList.py
@@ -131,12 +131,14 @@ class _PathList(object):
value = env.subst(value, target=target, source=source,
conv=node_conv)
if SCons.Util.is_Sequence(value):
- result.extend(value)
- continue
-
+ result.extend(SCons.Util.flatten(value))
+ elif value:
+ result.append(value)
elif type == TYPE_OBJECT:
value = node_conv(value)
- if value:
+ if value:
+ result.append(value)
+ elif value:
result.append(value)
return tuple(result)
diff --git a/src/engine/SCons/PathListTests.py b/src/engine/SCons/PathListTests.py
index 212c761..e83fc50 100644
--- a/src/engine/SCons/PathListTests.py
+++ b/src/engine/SCons/PathListTests.py
@@ -48,6 +48,8 @@ class subst_pathTestCase(unittest.TestCase):
return s
self.env = FakeEnvironment(AAA = 'aaa', NULL = '')
+ from SCons.Environment import Environment
+ self.env = Environment(AAA = 'aaa', NULL = '')
def test_node(self):
"""Test the subst_path() method on a Node
@@ -120,6 +122,40 @@ class subst_pathTestCase(unittest.TestCase):
assert result == ('aaa',), result
+ def test_list_of_lists(self):
+ """Test the subst_path() method on substitution of nested lists.
+ """
+ pl = SCons.PathList.PathList((['$AAA', '$AAA'], '$NULL'))
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('aaa', 'aaa'), result
+
+ def test_subst_nested(self):
+ """Test the subst_path() method on nested substitution of strings.
+ """
+ self.env.Append(L1 = ['a', 'b'],
+ L2 = ['c', 'd'],
+ L3 = ['$L2'])
+ pl = SCons.PathList.PathList(['$L1'])
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('a', 'b'), result
+ self.env.Append(L1 = ['$L2'])
+ pl = SCons.PathList.PathList(['$L1'])
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('a', 'b', 'c', 'd'), result
+ self.env.Append(L1 = ['$L3'])
+ pl = SCons.PathList.PathList(['$L1'])
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('a', 'b', 'c', 'd', 'c', 'd'), result
+
+ def test_another_env(self):
+ """Test the subst_path does lazy evaluation.
+ """
+ pl = SCons.PathList.PathList(('$AAA', '$NULL'))
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('aaa',), result
+ e = self.env.Clone(AAA = 'bbb')
+ result = pl.subst_path(e, 'y', 'z')
+ assert result == ('bbb',), result
class PathListCacheTestCase(unittest.TestCase):
diff --git a/src/engine/SCons/Tool/xgettext.py b/src/engine/SCons/Tool/xgettext.py
index 17e055f..64436b8 100644
--- a/src/engine/SCons/Tool/xgettext.py
+++ b/src/engine/SCons/Tool/xgettext.py
@@ -271,7 +271,10 @@ def generate(env,**kw):
import SCons.Util
from SCons.Tool.GettextCommon import RPaths, _detect_xgettext
- env['XGETTEXT'] = _detect_xgettext(env)
+ try:
+ env['XGETTEXT'] = _detect_xgettext(env)
+ except:
+ env['XGETTEXT'] = 'xgettext'
# NOTE: sources="$SOURCES" would work as well. However, we use following
# construction to convert absolute paths provided by scons onto paths
# relative to current working dir. Note, that scons expands $SOURCE(S) to