summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/EnvironmentTests.py
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2009-01-01 13:18:06 (GMT)
committerGary Oberbrunner <garyo@oberbrunner.com>2009-01-01 13:18:06 (GMT)
commite40b2b0ff3c82d704867a99662ebaad0597f0990 (patch)
tree9ae7dedcbcc3b5da01aaa084c59421f5b40d9f37 /src/engine/SCons/EnvironmentTests.py
parentcc05c121706797a7708d135ce20ff40039111fa7 (diff)
downloadSCons-e40b2b0ff3c82d704867a99662ebaad0597f0990.zip
SCons-e40b2b0ff3c82d704867a99662ebaad0597f0990.tar.gz
SCons-e40b2b0ff3c82d704867a99662ebaad0597f0990.tar.bz2
Fix bug 2193: http://scons.tigris.org/issues/show_bug.cgi?id=2193
Ap/PrependENVPath now accept paths starting with # and Dirs. Added optional _canonicalize arg to SCons.Util.Ap/PrependPath, and pass an implementation of that into them from Environment.Ap/PrependENVPath. Can't just always do the canonicalization in SCons.Util because there is no env there to get the fs to convert a #-prefixed path to the proper path.
Diffstat (limited to 'src/engine/SCons/EnvironmentTests.py')
-rw-r--r--src/engine/SCons/EnvironmentTests.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index f3210b8..0ea9dda 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -1613,6 +1613,13 @@ def exists(env):
assert(env1['ENV']['PATH'] == r'C:\dir\num\one;C:\dir\num\two;C:\dir\num\three')
assert(env1['MYENV']['MYPATH'] == r'C:\mydir\num\two;C:\mydir\num\three;C:\mydir\num\one')
+ test = TestCmd.TestCmd(workdir = '')
+ test.subdir('sub1', 'sub2')
+ p=env1['ENV']['PATH']
+ env1.AppendENVPath('PATH','#sub1', sep = ';')
+ env1.AppendENVPath('PATH',env1.fs.Dir('sub2'), sep = ';')
+ assert env1['ENV']['PATH'] == p + ';sub1;sub2', env1['ENV']['PATH']
+
def test_AppendUnique(self):
"""Test appending to unique values to construction variables
@@ -2259,17 +2266,12 @@ f5: \
assert(env1['ENV']['PATH'] == r'C:\dir\num\three;C:\dir\num\two;C:\dir\num\one')
assert(env1['MYENV']['MYPATH'] == r'C:\mydir\num\one;C:\mydir\num\three;C:\mydir\num\two')
- def test_PrependENVPath(self):
- """Test prepending to an ENV path."""
- env1 = self.TestEnvironment(ENV = {'PATH': r'C:\dir\num\one;C:\dir\num\two'},
- MYENV = {'MYPATH': r'C:\mydir\num\one;C:\mydir\num\two'})
- # have to include the pathsep here so that the test will work on UNIX too.
- env1.PrependENVPath('PATH',r'C:\dir\num\two',sep = ';')
- env1.PrependENVPath('PATH',r'C:\dir\num\three',sep = ';')
- env1.PrependENVPath('MYPATH',r'C:\mydir\num\three','MYENV',sep = ';')
- env1.PrependENVPath('MYPATH',r'C:\mydir\num\one','MYENV',sep = ';')
- assert(env1['ENV']['PATH'] == r'C:\dir\num\three;C:\dir\num\two;C:\dir\num\one')
- assert(env1['MYENV']['MYPATH'] == r'C:\mydir\num\one;C:\mydir\num\three;C:\mydir\num\two')
+ test = TestCmd.TestCmd(workdir = '')
+ test.subdir('sub1', 'sub2')
+ p=env1['ENV']['PATH']
+ env1.PrependENVPath('PATH','#sub1', sep = ';')
+ env1.PrependENVPath('PATH',env1.fs.Dir('sub2'), sep = ';')
+ assert env1['ENV']['PATH'] == 'sub2;sub1;' + p, env1['ENV']['PATH']
def test_PrependUnique(self):
"""Test prepending unique values to construction variables