Russel Winder avatar Russel Winder committed 8ea26f4 Merge

Merge in default/tip from the mainline.

Comments (0)

Files changed (10)

 
 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
 

src/engine/SCons/EnvironmentTests.py

         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')

src/engine/SCons/PathList.py

                 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)
 

src/engine/SCons/PathListTests.py

                 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
 
         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):
 

src/engine/SCons/Tool/xgettext.py

   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

test/packaging/option--package-type.py

 """
 
 import TestSCons
+import SCons.Tool.rpmutils
 
 _python_ = TestSCons._python_
 
 """ % locals())
 
 src_rpm = 'foo-1.2.3-0.src.rpm'
-machine_rpm = 'foo-1.2.3-0.*.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
 
 test.run(arguments='package PACKAGETYPE=rpm', stderr = None)
 
 test.must_exist( src_rpm )
-test.must_exist_one_of( [machine_rpm] )
+test.must_exist( machine_rpm )
 test.must_not_exist( 'bin/main.c' )
 test.must_not_exist( '/bin/main.c' )
 
 
 test.run(arguments='package --package-type=rpm', stderr = None)
 test.must_exist( src_rpm )
-test.must_exist_one_of( [machine_rpm] )
+test.must_exist( machine_rpm )
 test.must_not_exist( 'bin/main.c' )
 test.must_not_exist( '/bin/main.c' )
 

test/packaging/rpm/cleanup.py

 """
 
 import TestSCons
+import SCons.Tool.rpmutils
 
 _python_ = TestSCons._python_
 test = TestSCons.TestSCons()
 test.run( arguments='-c .' )
 
 src_rpm     = 'foo-1.2.3-0.src.rpm'
-machine_rpm = 'foo-1.2.3-0.*.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
 
-test.must_not_exist_any_of( [machine_rpm] )
+test.must_not_exist( machine_rpm )
 test.must_not_exist( src_rpm )
 test.must_not_exist( 'foo-1.2.3.tar.gz' )
 test.must_not_exist( 'foo-1.2.3.spec' )

test/packaging/rpm/internationalization.py

 """
 
 import os
-import glob
+import SCons.Tool.rpmutils
 
 import TestSCons
 
 test.run(arguments='', stderr = None)
 
 src_rpm = 'foo-1.2.3-0.src.rpm'
-machine_rpm = 'foo-1.2.3-0.*.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
 
 test.must_exist( src_rpm )
-test.must_exist_one_of( [machine_rpm] )
+test.must_exist( machine_rpm )
 
 test.must_not_exist( 'bin/main' )
 
-machine_rpm_path = glob.glob(machine_rpm)[0].lstrip('./')
 cmd = 'rpm -qp --queryformat \'%%{GROUP}-%%{SUMMARY}-%%{DESCRIPTION}\' %s'
 
 os.environ['LANGUAGE'] = 'de'
-out = os.popen( cmd % test.workpath(machine_rpm_path) ).read()
+out = os.popen( cmd % test.workpath(machine_rpm) ).read()
 test.fail_test( out != 'Applikation/büro-hallo-das sollte wirklich lang sein' )
 
 os.environ['LANGUAGE'] = 'fr'
-out = os.popen( cmd % test.workpath(machine_rpm_path) ).read()
+out = os.popen( cmd % test.workpath(machine_rpm) ).read()
 test.fail_test( out != 'Application/bureau-bonjour-ceci devrait être vraiment long' )
 
 os.environ['LANGUAGE'] = 'en'
-out = os.popen( cmd % test.workpath(machine_rpm_path) ).read()
+out = os.popen( cmd % test.workpath(machine_rpm) ).read()
 test.fail_test( out != 'Application/office-hello-this should be really long' )
 
 os.environ['LC_ALL'] = 'ae'
-out = os.popen( cmd % test.workpath(machine_rpm_path) ).read()
+out = os.popen( cmd % test.workpath(machine_rpm) ).read()
 test.fail_test( out != 'Application/office-hello-this should be really long' )
 
 #
 test.run(arguments='--install-sandbox=blubb install', stderr = None)
 
 test.must_exist( src_rpm )
-test.must_exist_one_of( [machine_rpm] )
+test.must_exist( machine_rpm )
 
 test.pass_test()
 

test/runtest/python.py

 head, python = os.path.split(TestRuntest.python)
 head, dir = os.path.split(head)
 
-mypython = os.path.join(head, dir, os.path.pardir, dir, python)
+# We have to normalize the python path here, because some installations don't like
+# getting called with "/bin/../bin/python" as first argument, e.g. Fedora 17 Desktop.
+mypython = os.path.normpath(os.path.join(head, dir, os.path.pardir, dir, python))
 
 def escape(s):
     return s.replace('\\', '\\\\')

test/sconsign/script/Configure.py

 test = TestSConsign.TestSConsign(match = TestSConsign.match_re,
                                  diff = TestSConsign.diff_re)
 
-CC = test.detect('CC', norm=1)
+# Note: Here we pass the full search PATH of our current system to
+# the detect() method. This way we try to ensure that we find the same
+# compiler executable as the SConstruct below, which uses
+# os.environ['PATH'] too.
+CC = test.detect('CC', ENV={'PATH' : os.environ.get('PATH','')}, norm=1)
 CC_dir, CC_file = os.path.split(CC)
 
 CC = re.escape(CC)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.