PharLap follow-on patch. (Charles Crain)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 25 Jan 2003 08:23:44 +0000 (08:23 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 25 Jan 2003 08:23:44 +0000 (08:23 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@566 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Tool/PharLapCommon.py
src/engine/SCons/Tool/PharLapCommonTests.py

index ddcaba6b4da75213c572203b820ce1330e08deff..7f562c53a2444248c01b72a53fe407fb19122e17 100644 (file)
@@ -94,9 +94,17 @@ def addPathIfNotExists(env_dict, key, path, sep=os.pathsep):
     separated by tokens.  The 'path' will get added to the list if it
     is not already there."""
     try:
-        paths = string.split(env_dict[key], sep)
+        is_list = 1
+        paths = env_dict[key]
+        if not SCons.Util.is_List(env_dict[key]):
+            paths = string.split(paths, sep)
+            is_list = 0
         if not os.path.normcase(path) in map(os.path.normcase, paths):
-            env_dict[key] = string.join([ path ] + paths, sep)
+            paths = [ path ] + paths
+        if is_list:
+            env_dict[key] = paths
+        else:
+            env_dict[key] = string.join(paths, sep)
     except KeyError:
         env_dict[key] = path
 
index 663b25e811e237d5e044611b6eaf784ebf3120ab..d1794570feaa26abffe30d807a9dbdc3c0bdd80f 100644 (file)
@@ -37,10 +37,14 @@ class PharLapCommonTestCase(unittest.TestCase):
         env_dict = { 'FOO' : os.path.normpath('/foo/bar') + os.pathsep + \
                      os.path.normpath('/baz/blat'),
                      'BAR' : os.path.normpath('/foo/bar') + os.pathsep + \
-                     os.path.normpath('/baz/blat') }
+                     os.path.normpath('/baz/blat'),
+                     'BLAT' : [ os.path.normpath('/foo/bar'),
+                                os.path.normpath('/baz/blat') ] }
         addPathIfNotExists(env_dict, 'FOO', os.path.normpath('/foo/bar'))
         addPathIfNotExists(env_dict, 'BAR', os.path.normpath('/bar/foo'))
         addPathIfNotExists(env_dict, 'BAZ', os.path.normpath('/foo/baz'))
+        addPathIfNotExists(env_dict, 'BLAT', os.path.normpath('/baz/blat'))
+        addPathIfNotExists(env_dict, 'BLAT', os.path.normpath('/baz/foo'))
 
         assert env_dict['FOO'] == os.path.normpath('/foo/bar') + os.pathsep + \
                os.path.normpath('/baz/blat'), env_dict['FOO']
@@ -48,6 +52,9 @@ class PharLapCommonTestCase(unittest.TestCase):
                os.path.normpath('/foo/bar') + os.pathsep + \
                os.path.normpath('/baz/blat'), env_dict['BAR']
         assert env_dict['BAZ'] == os.path.normpath('/foo/baz'), env_dict['BAZ']
+        assert env_dict['BLAT'] == [ os.path.normpath('/baz/foo'),
+                                     os.path.normpath('/foo/bar'),
+                                     os.path.normpath('/baz/blat') ], env_dict['BLAT' ]
 
 if __name__ == "__main__":
     suite = unittest.makeSuite(PharLapCommonTestCase, 'test_')