diff options
| author | Steven Knight <knight@baldmt.com> | 2003-01-25 08:23:44 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-01-25 08:23:44 (GMT) |
| commit | fb4152bf88a71d44c6ec7627d63dae6b93ee348a (patch) | |
| tree | 9c506726dc7fe09a5eea07927d2ec8d5a13e5cb9 /src/engine | |
| parent | 9a87f34a20ea2f5ec420548a379b2818450325ef (diff) | |
| download | SCons-fb4152bf88a71d44c6ec7627d63dae6b93ee348a.zip SCons-fb4152bf88a71d44c6ec7627d63dae6b93ee348a.tar.gz SCons-fb4152bf88a71d44c6ec7627d63dae6b93ee348a.tar.bz2 | |
PharLap follow-on patch. (Charles Crain)
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/SCons/Tool/PharLapCommon.py | 12 | ||||
| -rw-r--r-- | src/engine/SCons/Tool/PharLapCommonTests.py | 9 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/engine/SCons/Tool/PharLapCommon.py b/src/engine/SCons/Tool/PharLapCommon.py index ddcaba6..7f562c5 100644 --- a/src/engine/SCons/Tool/PharLapCommon.py +++ b/src/engine/SCons/Tool/PharLapCommon.py @@ -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 diff --git a/src/engine/SCons/Tool/PharLapCommonTests.py b/src/engine/SCons/Tool/PharLapCommonTests.py index 663b25e..d179457 100644 --- a/src/engine/SCons/Tool/PharLapCommonTests.py +++ b/src/engine/SCons/Tool/PharLapCommonTests.py @@ -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_') |
