diff options
author | Steven Knight <knight@baldmt.com> | 2004-02-26 05:56:51 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-02-26 05:56:51 (GMT) |
commit | dfa9ded59f8641221328e2da7a06698a1b367ef1 (patch) | |
tree | cc4a700d072dff78736d245d7c664be7ad2d32f0 /test | |
parent | b0656def14f9b2f7feff88301420c1dee99ac670 (diff) | |
download | SCons-dfa9ded59f8641221328e2da7a06698a1b367ef1.zip SCons-dfa9ded59f8641221328e2da7a06698a1b367ef1.tar.gz SCons-dfa9ded59f8641221328e2da7a06698a1b367ef1.tar.bz2 |
Initialize *FLAGS variables with objects that can add flags either as strings or lists.
Diffstat (limited to 'test')
-rw-r--r-- | test/ARFLAGS.py | 4 | ||||
-rw-r--r-- | test/CVS.py | 4 | ||||
-rw-r--r-- | test/GSFLAGS.py | 2 | ||||
-rw-r--r-- | test/Options.py | 27 | ||||
-rw-r--r-- | test/RANLIBFLAGS.py | 4 | ||||
-rw-r--r-- | test/SHLINKFLAGS.py | 4 |
6 files changed, 21 insertions, 24 deletions
diff --git a/test/ARFLAGS.py b/test/ARFLAGS.py index 54cb463..a9dc572 100644 --- a/test/ARFLAGS.py +++ b/test/ARFLAGS.py @@ -44,10 +44,8 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = ['foo'], LIBPATH = ['.']) -ar = foo.Dictionary('AR') -arflags = foo.Dictionary('ARFLAGS') bar = Environment(LIBS = ['bar'], LIBPATH = ['.'], - AR = '', ARFLAGS = r'%s wrapper.py ' + ar + ' ' + arflags) + AR = '', ARFLAGS = foo.subst(r'%s wrapper.py $AR $ARFLAGS')) foo.Library(target = 'foo', source = 'foo.c') bar.Library(target = 'bar', source = 'bar.c') diff --git a/test/CVS.py b/test/CVS.py index 85e11fe..2eed3d2 100644 --- a/test/CVS.py +++ b/test/CVS.py @@ -105,7 +105,7 @@ def cat(env, source, target): f.close() env = Environment(ENV = { 'PATH' : os.environ['PATH'] }, BUILDERS={'Cat':Builder(action=cat)}) -env.Prepend(CVSFLAGS='-Q ') +env.Prepend(CVSFLAGS='-Q') env.Cat('aaa.out', 'foo/aaa.in') env.Cat('bbb.out', 'foo/bbb.in') env.Cat('ccc.out', 'foo/ccc.in') @@ -175,7 +175,7 @@ def cat(env, source, target): f.close() env = Environment(ENV = { 'PATH' : os.environ['PATH'] }, BUILDERS={'Cat':Builder(action=cat)}) -env.Prepend(CVSFLAGS='-q ') +env.Prepend(CVSFLAGS='-q') env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') env.Cat('ccc.out', 'ccc.in') diff --git a/test/GSFLAGS.py b/test/GSFLAGS.py index 114d5c9..14ce769 100644 --- a/test/GSFLAGS.py +++ b/test/GSFLAGS.py @@ -95,7 +95,7 @@ os.system(cmd) import os ENV = { 'PATH' : os.environ['PATH'] } foo = Environment(ENV = ENV) -foo.Append(GSFLAGS = ' -q') +foo.Append(GSFLAGS = '-q') foo.PDF(target = 'foo.pdf', source = 'foo.ps') """) diff --git a/test/Options.py b/test/Options.py index 0e21aa9..c98ffc6 100644 --- a/test/Options.py +++ b/test/Options.py @@ -30,15 +30,18 @@ import string test = TestSCons.TestSCons() test.write('SConstruct', """ +import string env = Environment() print env['CC'] -print env['CCFLAGS'] +print string.join(env['CCFLAGS']) Default(env.Alias('dummy', None)) """) test.run() cc, ccflags = string.split(test.stdout(), '\n')[1:3] test.write('SConstruct', """ +import string + # test validator. Change a key and add a new one to the environment def validator(key, value, environ): environ[key] = "v" @@ -71,9 +74,9 @@ opts.Add('UNSPECIFIED', def test_tool(env): if env['RELEASE_BUILD']: - env['CCFLAGS'] = env['CCFLAGS'] + ' -O' + env.Append(CCFLAGS = '-O') if env['DEBUG_BUILD']: - env['CCFLAGS'] = env['CCFLAGS'] + ' -g' + env.Append(CCFLAGS = '-g') env = Environment(options=opts, tools=['default', test_tool]) @@ -83,7 +86,7 @@ Help('Variables settable in custom.py or on the command line:\\n' + opts.Generat print env['RELEASE_BUILD'] print env['DEBUG_BUILD'] print env['CC'] -print env['CCFLAGS'] +print string.join(env['CCFLAGS']) print env['VALIDATE'] print env['valid_key'] @@ -109,22 +112,22 @@ def check(expect): assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) test.run() -check(['0', '1', cc, ccflags + ' -g', 'v', 'v']) +check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v']) test.run(arguments='"RELEASE_BUILD=1"') -check(['1', '1', cc, ccflags + ' -O -g', 'v', 'v']) +check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v']) test.run(arguments='"RELEASE_BUILD=1" "DEBUG_BUILD=0"') -check(['1', '0', cc, ccflags + ' -O', 'v', 'v']) +check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v']) test.run(arguments='"CC=not_a_c_compiler"') -check(['0', '1', 'not_a_c_compiler', ccflags + ' -g', 'v', 'v']) +check(['0', '1', 'not_a_c_compiler', string.strip(ccflags + ' -g'), 'v', 'v']) test.run(arguments='"UNDECLARED=foo"') -check(['0', '1', cc, ccflags + ' -g', 'v', 'v']) +check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v']) test.run(arguments='"CCFLAGS=--taco"') -check(['0', '1', cc, ccflags + ' -g', 'v', 'v']) +check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v']) test.write('custom.py', """ DEBUG_BUILD=0 @@ -132,10 +135,10 @@ RELEASE_BUILD=1 """) test.run() -check(['1', '0', cc, ccflags + ' -O', 'v', 'v']) +check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v']) test.run(arguments='"DEBUG_BUILD=1"') -check(['1', '1', cc, ccflags + ' -O -g', 'v', 'v']) +check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v']) test.run(arguments='-h', stdout = """scons: Reading SConscript files ... diff --git a/test/RANLIBFLAGS.py b/test/RANLIBFLAGS.py index fec606d..07da92e 100644 --- a/test/RANLIBFLAGS.py +++ b/test/RANLIBFLAGS.py @@ -48,10 +48,8 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = ['foo'], LIBPATH = ['.']) -ranlib = foo.Dictionary('RANLIB') -ranlibflags = foo.Dictionary('RANLIBFLAGS') bar = Environment(LIBS = ['bar'], LIBPATH = ['.'], RANLIB = '', - RANLIBFLAGS = r'%s wrapper.py ' + ranlib + ' ' + ranlibflags) + RANLIBFLAGS = foo.subst(r'%s wrapper.py $RANLIB $RANLIBFLAGS')) foo.Library(target = 'foo', source = 'foo.c') bar.Library(target = 'bar', source = 'bar.c') diff --git a/test/SHLINKFLAGS.py b/test/SHLINKFLAGS.py index b7f18ca..88e2442 100644 --- a/test/SHLINKFLAGS.py +++ b/test/SHLINKFLAGS.py @@ -45,10 +45,8 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment() -shlink = foo.Dictionary('SHLINK') -shlinkflags = foo.Dictionary('SHLINKFLAGS') bar = Environment(SHLINK = '', - SHLINKFLAGS = r'%s wrapper.py ' + shlink + ' ' + shlinkflags) + SHLINKFLAGS = foo.subst(r'%s wrapper.py $SHLINK $SHLINKFLAGS')) foo.SharedLibrary(target = 'foo', source = 'foo.c') bar.SharedLibrary(target = 'bar', source = 'bar.c') """ % python) |