diff options
author | William Deegan <bill@baddogconsulting.com> | 2018-01-30 02:05:19 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2018-01-30 02:05:19 (GMT) |
commit | edffc6d98dbd4515827b56671f985209c2f63f3d (patch) | |
tree | 95c0ab02091d0c506ad4be98551c07dfc231f4c9 /test | |
parent | 275cf49d568e049f176798495d81324ebae7f628 (diff) | |
download | SCons-edffc6d98dbd4515827b56671f985209c2f63f3d.zip SCons-edffc6d98dbd4515827b56671f985209c2f63f3d.tar.gz SCons-edffc6d98dbd4515827b56671f985209c2f63f3d.tar.bz2 |
Remove SCons.Options code which has long been deprecated and already removed from documents. Also remove associated tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/Deprecated/Options/BoolOption.py | 92 | ||||
-rw-r--r-- | test/Deprecated/Options/EnumOption.py | 118 | ||||
-rw-r--r-- | test/Deprecated/Options/ListOption.py | 193 | ||||
-rw-r--r-- | test/Deprecated/Options/Options.py | 386 | ||||
-rw-r--r-- | test/Deprecated/Options/PackageOption.py | 98 | ||||
-rw-r--r-- | test/Deprecated/Options/PathOption.py | 296 | ||||
-rw-r--r-- | test/Deprecated/Options/chdir.py | 80 | ||||
-rw-r--r-- | test/Deprecated/Options/help.py | 170 | ||||
-rw-r--r-- | test/Deprecated/Options/import.py | 78 |
9 files changed, 0 insertions, 1511 deletions
diff --git a/test/Deprecated/Options/BoolOption.py b/test/Deprecated/Options/BoolOption.py deleted file mode 100644 index 5d12fc6..0000000 --- a/test/Deprecated/Options/BoolOption.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Test the BoolOption canned Option type. -""" - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -SConstruct_path = test.workpath('SConstruct') - -def check(expect): - result = test.stdout().split('\n') - assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) - - -test.write(SConstruct_path, """\ -SetOption('warn', 'deprecated-options') -from SCons.Options.BoolOption import BoolOption -BO = BoolOption - -from SCons.Options import BoolOption - -opts = Options(args=ARGUMENTS) -opts.AddOptions( - BoolOption('warnings', 'compilation with -Wall and similiar', 1), - BO('profile', 'create profiling informations', 0), - ) - -env = Environment(options=opts) -Help(opts.GenerateHelpText(env)) - -print(env['warnings']) -print(env['profile']) - -Default(env.Alias('dummy', None)) -""") - - -warnings = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -%s -scons: warning: The BoolOption\\(\\) function is deprecated; use the BoolVariable\\(\\) function instead. -%s""" % (TestSCons.file_expr, TestSCons.file_expr) - -test.run(stderr=warnings) - -check([str(True), str(False)]) - -test.run(arguments='warnings=0 profile=no profile=true', stderr=warnings) -check([str(False), str(True)]) - -expect_stderr = (warnings + """ -scons: \\*\\*\\* Error converting option: warnings -Invalid value for boolean option: irgendwas -""" + TestSCons.file_expr) - -test.run(arguments='warnings=irgendwas', stderr=expect_stderr, status=2) - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/Options/EnumOption.py b/test/Deprecated/Options/EnumOption.py deleted file mode 100644 index 02afef1..0000000 --- a/test/Deprecated/Options/EnumOption.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Test the EnumOption canned Option type. -""" - -import os.path - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -SConstruct_path = test.workpath('SConstruct') - -def check(expect): - result = test.stdout().split('\n') - assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) - - - -test.write(SConstruct_path, """\ - -from SCons.Options.EnumOption import EnumOption -EO = EnumOption - -from SCons.Options import EnumOption - -list_of_libs = Split('x11 gl qt ical') - -opts = Options(args=ARGUMENTS) -opts.AddOptions( - EnumOption('debug', 'debug output and symbols', 'no', - allowed_values=('yes', 'no', 'full'), - map={}, ignorecase=0), # case sensitive - EnumOption('guilib', 'gui lib to use', 'gtk', - allowed_values=('motif', 'gtk', 'kde'), - map={}, ignorecase=1), # case insensitive - EO('some', 'some option', 'xaver', - allowed_values=('xaver', 'eins'), - map={}, ignorecase=2), # make lowercase - ) - -env = Environment(options=opts) -Help(opts.GenerateHelpText(env)) - -print(env['debug']) -print(env['guilib']) -print(env['some']) - -Default(env.Alias('dummy', None)) -""") - - - -warnings = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -%s -scons: warning: The EnumOption\\(\\) function is deprecated; use the EnumVariable\\(\\) function instead. -%s""" % (TestSCons.file_expr, TestSCons.file_expr) - -test.run(stderr=warnings); check(['no', 'gtk', 'xaver']) - -test.run(arguments='debug=yes guilib=Motif some=xAVER', stderr=warnings) -check(['yes', 'Motif', 'xaver']) - -test.run(arguments='debug=full guilib=KdE some=EiNs', stderr=warnings) -check(['full', 'KdE', 'eins']) - -expect_stderr = warnings + """ -scons: \\*\\*\\* Invalid value for option debug: FULL. Valid values are: \\('yes', 'no', 'full'\\) -""" + TestSCons.file_expr - -test.run(arguments='debug=FULL', stderr=expect_stderr, status=2) - -expect_stderr = warnings + """ -scons: \\*\\*\\* Invalid value for option guilib: irgendwas. Valid values are: \\('motif', 'gtk', 'kde'\\) -""" + TestSCons.file_expr - -test.run(arguments='guilib=IrGeNdwas', stderr=expect_stderr, status=2) - -expect_stderr = warnings + """ -scons: \\*\\*\\* Invalid value for option some: irgendwas. Valid values are: \\('xaver', 'eins'\\) -""" + TestSCons.file_expr - -test.run(arguments='some=IrGeNdwas', stderr=expect_stderr, status=2) - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/Options/ListOption.py b/test/Deprecated/Options/ListOption.py deleted file mode 100644 index 42af511..0000000 --- a/test/Deprecated/Options/ListOption.py +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Test the ListOption canned Option type. -""" - -import os - -import TestSCons - - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -SConstruct_path = test.workpath('SConstruct') - -def check(expect): - result = test.stdout().split('\n') - r = result[1:len(expect)+1] - assert r == expect, (r, expect) - - - -test.write(SConstruct_path, """\ -from SCons.Options.ListOption import ListOption -LO = ListOption - -from SCons.Options import ListOption - -list_of_libs = Split('x11 gl qt ical') - -optsfile = 'scons.options' -opts = Options(optsfile, args=ARGUMENTS) -opts.AddOptions( - ListOption('shared', - 'libraries to build as shared libraries', - 'all', - names = list_of_libs, - map = {'GL':'gl', 'QT':'qt'}), - LO('listvariable', 'listvariable help', 'all', names=['l1', 'l2', 'l3']) - ) - -env = Environment(options=opts) -opts.Save(optsfile, env) -Help(opts.GenerateHelpText(env)) - -print(env['shared']) - -if 'ical' in env['shared']: - print('1') -else: - print('0') - -print(" ".join(env['shared'])) - -print(env.subst('$shared')) -# Test subst_path() because it's used in $CPPDEFINES expansions. -print(env.subst_path('$shared')) -Default(env.Alias('dummy', None)) -""") - -warnings = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -%s -scons: warning: The ListOption\\(\\) function is deprecated; use the ListVariable\\(\\) function instead. -%s""" % (TestSCons.file_expr, TestSCons.file_expr) - -test.run(stderr=warnings) -check(['all', '1', 'gl ical qt x11', 'gl ical qt x11', - "['gl ical qt x11']"]) - -expect = "shared = 'all'"+os.linesep+"listvariable = 'all'"+os.linesep -test.must_match(test.workpath('scons.options'), expect) - -check(['all', '1', 'gl ical qt x11', 'gl ical qt x11', - "['gl ical qt x11']"]) - -test.run(arguments='shared=none', stderr=warnings) -check(['none', '0', '', '', "['']"]) - -test.run(arguments='shared=', stderr=warnings) -check(['none', '0', '', '', "['']"]) - -test.run(arguments='shared=x11,ical', stderr=warnings) -check(['ical,x11', '1', 'ical x11', 'ical x11', - "['ical x11']"]) - -test.run(arguments='shared=x11,,ical,,', stderr=warnings) -check(['ical,x11', '1', 'ical x11', 'ical x11', - "['ical x11']"]) - -test.run(arguments='shared=GL', stderr=warnings) -check(['gl', '0', 'gl', 'gl']) - -test.run(arguments='shared=QT,GL', stderr=warnings) -check(['gl,qt', '0', 'gl qt', 'gl qt', "['gl qt']"]) - - -expect_stderr = warnings + """ -scons: \\*\\*\\* Error converting option: shared -Invalid value\\(s\\) for option: foo -""" + TestSCons.file_expr - -test.run(arguments='shared=foo', stderr=expect_stderr, status=2) - -# be paranoid in testing some more combinations - -expect_stderr = warnings + """ -scons: \\*\\*\\* Error converting option: shared -Invalid value\\(s\\) for option: foo -""" + TestSCons.file_expr - -test.run(arguments='shared=foo,ical', stderr=expect_stderr, status=2) - -expect_stderr = warnings +""" -scons: \\*\\*\\* Error converting option: shared -Invalid value\\(s\\) for option: foo -""" + TestSCons.file_expr - -test.run(arguments='shared=ical,foo', stderr=expect_stderr, status=2) - -expect_stderr = warnings +""" -scons: \\*\\*\\* Error converting option: shared -Invalid value\\(s\\) for option: foo -""" + TestSCons.file_expr - -test.run(arguments='shared=ical,foo,x11', stderr=expect_stderr, status=2) - -expect_stderr = warnings +""" -scons: \\*\\*\\* Error converting option: shared -Invalid value\\(s\\) for option: foo,bar -""" + TestSCons.file_expr - -test.run(arguments='shared=foo,x11,,,bar', stderr=expect_stderr, status=2) - - - -test.write('SConstruct', """ -from SCons.Options import ListOption - -opts = Options(args=ARGUMENTS) -opts.AddOptions( - ListOption('gpib', - 'comment', - ['ENET', 'GPIB'], - names = ['ENET', 'GPIB', 'LINUX_GPIB', 'NO_GPIB']), - ) - -env = Environment(options=opts) -Help(opts.GenerateHelpText(env)) - -print(env['gpib']) -Default(env.Alias('dummy', None)) -""") - -expect = test.wrap_stdout(read_str="ENET,GPIB\n", build_str="""\ -scons: Nothing to be done for `dummy'. -""") - -test.run(stdout=expect, stderr=warnings) - - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/Options/Options.py b/test/Deprecated/Options/Options.py deleted file mode 100644 index f196b79..0000000 --- a/test/Deprecated/Options/Options.py +++ /dev/null @@ -1,386 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -test.write('SConstruct', """ -DefaultEnvironment(tools=[]) -env = Environment() -print(env['CC']) -print(" ".join(env['CCFLAGS'])) -Default(env.Alias('dummy', None)) -""") -test.run() -cc, ccflags = test.stdout().split('\n')[1:3] - -test.write('SConstruct', """ -DefaultEnvironment(tools=[]) -# test validator. Change a key and add a new one to the environment -def validator(key, value, environ): - environ[key] = "v" - environ["valid_key"] = "v" - - -def old_converter (value): - return "old_converter" - -def new_converter (value, env): - return "new_converter" - - -opts = Options('custom.py') -opts.Add('RELEASE_BUILD', - 'Set to 1 to build a release build', - 0, - None, - int) - -opts.Add('DEBUG_BUILD', - 'Set to 1 to build a debug build', - 1, - None, - int) - -opts.Add('CC', - 'The C compiler') - -opts.Add('VALIDATE', - 'An option for testing validation', - "notset", - validator, - None) - -opts.Add('OLD_CONVERTER', - 'An option for testing converters that take one parameter', - "foo", - None, - old_converter) - -opts.Add('NEW_CONVERTER', - 'An option for testing converters that take two parameters', - "foo", - None, - new_converter) - -opts.Add('UNSPECIFIED', - 'An option with no value') - -def test_tool(env): - if env['RELEASE_BUILD']: - env.Append(CCFLAGS = '-O') - if env['DEBUG_BUILD']: - env.Append(CCFLAGS = '-g') - - -env = Environment(options=opts, tools=['default', test_tool]) - -Help('Variables settable in custom.py or on the command line:\\n' + opts.GenerateHelpText(env)) - -print(env['RELEASE_BUILD']) -print(env['DEBUG_BUILD']) -print(env['CC']) -print(" ".join(env['CCFLAGS'])) -print(env['VALIDATE']) -print(env['valid_key']) - -# unspecified options should not be set: -assert 'UNSPECIFIED' not in env - -# undeclared options should be ignored: -assert 'UNDECLARED' not in env - -# calling Update() should not effect options that -# are not declared on the options object: -r = env['RELEASE_BUILD'] -opts = Options() -opts.Update(env) -assert env['RELEASE_BUILD'] == r - -Default(env.Alias('dummy', None)) - -""") - -warnings = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -""" + TestSCons.file_expr - - -def check(expect): - result = test.stdout().split('\n') - assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) - -test.run(stderr=warnings) -check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v']) - -test.run(arguments='RELEASE_BUILD=1', stderr=warnings) -check(['1', '1', cc, (ccflags + ' -O -g').strip(), 'v', 'v']) - -test.run(arguments='RELEASE_BUILD=1 DEBUG_BUILD=0', stderr=warnings) -check(['1', '0', cc, (ccflags + ' -O').strip(), 'v', 'v']) - -test.run(arguments='CC=not_a_c_compiler', stderr=warnings) -check(['0', '1', 'not_a_c_compiler', (ccflags + ' -g').strip(), 'v', 'v']) - -test.run(arguments='UNDECLARED=foo', stderr=warnings) -check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v']) - -test.run(arguments='CCFLAGS=--taco', stderr=warnings) -check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v']) - -test.write('custom.py', """ -DEBUG_BUILD=0 -RELEASE_BUILD=1 -""") - -test.run(stderr=warnings) -check(['1', '0', cc, (ccflags + ' -O').strip(), 'v', 'v']) - -test.run(arguments='DEBUG_BUILD=1', stderr=warnings) -check(['1', '1', cc, (ccflags + ' -O -g').strip(), 'v', 'v']) - -test.run(arguments='-h', - stdout = """\ -scons: Reading SConscript files ... -1 -0 -%s -%s -v -v -scons: done reading SConscript files. -Variables settable in custom.py or on the command line: - -RELEASE_BUILD: Set to 1 to build a release build - default: 0 - actual: 1 - -DEBUG_BUILD: Set to 1 to build a debug build - default: 1 - actual: 0 - -CC: The C compiler - default: None - actual: %s - -VALIDATE: An option for testing validation - default: notset - actual: v - -OLD_CONVERTER: An option for testing converters that take one parameter - default: foo - actual: old_converter - -NEW_CONVERTER: An option for testing converters that take two parameters - default: foo - actual: new_converter - -UNSPECIFIED: An option with no value - default: None - actual: None - -Use scons -H for help about command-line options. -"""%(cc, ccflags and ccflags + ' -O' or '-O', cc), - stderr=warnings) - -# Test saving of options and multi loading -# -test.write('SConstruct', """ -DefaultEnvironment(tools=[]) - -opts = Options(['custom.py', 'options.saved']) -opts.Add('RELEASE_BUILD', - 'Set to 1 to build a release build', - 0, - None, - int) - -opts.Add('DEBUG_BUILD', - 'Set to 1 to build a debug build', - 1, - None, - int) - -opts.Add('UNSPECIFIED', - 'An option with no value') - -env = Environment(options = opts) - -print(env['RELEASE_BUILD']) -print(env['DEBUG_BUILD']) - -opts.Save('options.saved', env) -""") - -# Check the save file by executing and comparing against -# the expected dictionary -def checkSave(file, expected): - gdict = {} - ldict = {} - exec(open(file, 'r').read(), gdict, ldict) - assert expected == ldict, "%s\n...not equal to...\n%s" % (expected, ldict) - -# First test with no command line options -# This should just leave the custom.py settings -test.run(stderr=warnings) -check(['1','0']) -checkSave('options.saved', { 'RELEASE_BUILD':1, 'DEBUG_BUILD':0}) - -# Override with command line arguments -test.run(arguments='DEBUG_BUILD=3', stderr=warnings) -check(['1','3']) -checkSave('options.saved', {'RELEASE_BUILD':1, 'DEBUG_BUILD':3}) - -# Now make sure that saved options are overridding the custom.py -test.run(stderr=warnings) -check(['1','3']) -checkSave('options.saved', {'DEBUG_BUILD':3, 'RELEASE_BUILD':1}) - -# Load no options from file(s) -# Used to test for correct output in save option file -test.write('SConstruct', """ -DefaultEnvironment(tools=[]) - -opts = Options() -opts.Add('RELEASE_BUILD', - 'Set to 1 to build a release build', - '0', - None, - int) - -opts.Add('DEBUG_BUILD', - 'Set to 1 to build a debug build', - '1', - None, - int) - -opts.Add('UNSPECIFIED', - 'An option with no value') - -opts.Add('LISTOPTION_TEST', - 'testing list option persistence', - 'none', - names = ['a','b','c',]) - -env = Environment(options = opts) - -print(env['RELEASE_BUILD']) -print(env['DEBUG_BUILD']) -print(env['LISTOPTION_TEST']) - -opts.Save('options.saved', env) -""") - -# First check for empty output file when nothing is passed on command line -test.run(stderr=warnings) -check(['0','1']) -checkSave('options.saved', {}) - -# Now specify one option the same as default and make sure it doesn't write out -test.run(arguments='DEBUG_BUILD=1', stderr=warnings) -check(['0','1']) -checkSave('options.saved', {}) - -# Now specify same option non-default and make sure only it is written out -test.run(arguments='DEBUG_BUILD=0 LISTOPTION_TEST=a,b', stderr=warnings) -check(['0','0']) -checkSave('options.saved',{'DEBUG_BUILD':0, 'LISTOPTION_TEST':'a,b'}) - -test.write('SConstruct', """ -DefaultEnvironment(tools=[]) - -opts = Options('custom.py') -opts.Add('RELEASE_BUILD', - 'Set to 1 to build a release build', - 0, - None, - int) - -opts.Add('DEBUG_BUILD', - 'Set to 1 to build a debug build', - 1, - None, - int) - -opts.Add('CC', - 'The C compiler') - -opts.Add('UNSPECIFIED', - 'An option with no value') - -env = Environment(options=opts) - -def compare(a, b): - return (a > b) - (a < b) - -Help('Variables settable in custom.py or on the command line:\\n' + opts.GenerateHelpText(env,sort=compare)) - -""") - -test.run(arguments='-h', - stdout = """\ -scons: Reading SConscript files ... -scons: done reading SConscript files. -Variables settable in custom.py or on the command line: - -CC: The C compiler - default: None - actual: %s - -DEBUG_BUILD: Set to 1 to build a debug build - default: 1 - actual: 0 - -RELEASE_BUILD: Set to 1 to build a release build - default: 0 - actual: 1 - -UNSPECIFIED: An option with no value - default: None - actual: None - -Use scons -H for help about command-line options. -"""%cc, - stderr=warnings) - -test.write('SConstruct', """ -DefaultEnvironment(tools=[]) - -import SCons.Options -env1 = Environment(options = Options()) -env2 = Environment(options = SCons.Options.Options()) -""") - -test.run(stderr=warnings) - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/Options/PackageOption.py b/test/Deprecated/Options/PackageOption.py deleted file mode 100644 index ec8990c..0000000 --- a/test/Deprecated/Options/PackageOption.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Test the PackageOption canned Option type. -""" - -import os - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -SConstruct_path = test.workpath('SConstruct') - -def check(expect): - result = test.stdout().split('\n') - assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) - - - -test.write(SConstruct_path, """\ -from SCons.Options.PackageOption import PackageOption -PO = PackageOption - -from SCons.Options import PackageOption - -opts = Options(args=ARGUMENTS) -opts.AddOptions( - PackageOption('x11', - 'use X11 installed here (yes = search some places', - 'yes'), - PO('package', 'help for package', 'yes'), - ) - -env = Environment(options=opts) -Help(opts.GenerateHelpText(env)) - -print(env['x11']) -Default(env.Alias('dummy', None)) -""") - -warnings = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -%s -scons: warning: The PackageOption\\(\\) function is deprecated; use the PackageVariable\\(\\) function instead. -%s""" % (TestSCons.file_expr, TestSCons.file_expr) - -test.run(stderr=warnings) -check([str(True)]) - -test.run(arguments='x11=no', stderr=warnings) -check([str(False)]) - -test.run(arguments='x11=0', stderr=warnings) -check([str(False)]) - -test.run(arguments=['x11=%s' % test.workpath()], stderr=warnings) -check([test.workpath()]) - -expect_stderr = warnings + """ -scons: \\*\\*\\* Path does not exist for option x11: /non/existing/path/ -""" + TestSCons.file_expr - -test.run(arguments='x11=/non/existing/path/', stderr=expect_stderr, status=2) - - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/Options/PathOption.py b/test/Deprecated/Options/PathOption.py deleted file mode 100644 index 0e6949c..0000000 --- a/test/Deprecated/Options/PathOption.py +++ /dev/null @@ -1,296 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Test the PathOption canned option type, with tests for its -various canned validators. -""" - -import os.path -import re - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -SConstruct_path = test.workpath('SConstruct') - -def check(expect): - result = test.stdout().split('\n') - assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) - -#### test PathOption #### - -test.subdir('lib', 'qt', ['qt', 'lib'], 'nolib' ) -workpath = test.workpath() -libpath = os.path.join(workpath, 'lib') - -test.write(SConstruct_path, """\ -from SCons.Options.PathOption import PathOption -PO = PathOption - -from SCons.Options import PathOption - -qtdir = r'%s' - -opts = Options(args=ARGUMENTS) -opts.AddOptions( - PathOption('qtdir', 'where the root of Qt is installed', qtdir), - PO('qt_libraries', 'where the Qt library is installed', r'%s'), - ) - -env = Environment(options=opts) -Help(opts.GenerateHelpText(env)) - -print(env['qtdir']) -print(env['qt_libraries']) -print(env.subst('$qt_libraries')) - -Default(env.Alias('dummy', None)) -""" % (workpath, os.path.join('$qtdir', 'lib') )) - -warnings = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -%s -scons: warning: The PathOption\\(\\) function is deprecated; use the PathVariable\\(\\) function instead. -%s""" % (TestSCons.file_expr, TestSCons.file_expr) - -qtpath = workpath -libpath = os.path.join(qtpath, 'lib') -test.run(stderr=warnings) -check([qtpath, os.path.join('$qtdir', 'lib'), libpath]) - -qtpath = os.path.join(workpath, 'qt') -libpath = os.path.join(qtpath, 'lib') -test.run(arguments=['qtdir=%s' % qtpath], stderr=warnings) -check([qtpath, os.path.join('$qtdir', 'lib'), libpath]) - -qtpath = workpath -libpath = os.path.join(qtpath, 'nolib') -test.run(arguments=['qt_libraries=%s' % libpath], stderr=warnings) -check([qtpath, libpath, libpath]) - -qtpath = os.path.join(workpath, 'qt') -libpath = os.path.join(workpath, 'nolib') -test.run(arguments=['qtdir=%s' % qtpath, 'qt_libraries=%s' % libpath], stderr=warnings) -check([qtpath, libpath, libpath]) - -qtpath = os.path.join(workpath, 'non', 'existing', 'path') -qtpath_re = re.escape(qtpath) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* Path for option qtdir does not exist: %(qtpath_re)s -""" % locals()) + TestSCons.file_expr - -test.run(arguments=['qtdir=%s' % qtpath], stderr=expect_stderr, status=2) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* Path for option qt_libraries does not exist: %(qtpath_re)s -""" % locals()) + TestSCons.file_expr - -test.run(arguments=['qt_libraries=%s' % qtpath], stderr=expect_stderr, status=2) - - - -default_file = test.workpath('default_file') -default_subdir = test.workpath('default_subdir') - -existing_subdir = test.workpath('existing_subdir') -test.subdir(existing_subdir) - -existing_file = test.workpath('existing_file') -test.write(existing_file, "existing_file\n") - -non_existing_subdir = test.workpath('non_existing_subdir') -non_existing_file = test.workpath('non_existing_file') - -default_file_re = re.escape(default_file) -default_subdir_re = re.escape(default_subdir) -existing_subdir_re = re.escape(existing_subdir) -existing_file_re = re.escape(existing_file) -non_existing_subdir_re = re.escape(non_existing_subdir) -non_existing_file_re = re.escape(non_existing_file) - - - -test.write('SConstruct', """\ -opts = Options(args=ARGUMENTS) -opts.AddOptions( - PathOption('X', 'X variable', r'%s', validator=PathOption.PathAccept), - ) - -env = Environment(options=opts) - -print(env['X']) - -Default(env.Alias('dummy', None)) -""" % default_subdir) - -test.run(stderr=warnings) -check([default_subdir]) - -test.run(arguments=['X=%s' % existing_file], stderr=warnings) -check([existing_file]) - -test.run(arguments=['X=%s' % non_existing_file], stderr=warnings) -check([non_existing_file]) - -test.run(arguments=['X=%s' % existing_subdir], stderr=warnings) -check([existing_subdir]) - -test.run(arguments=['X=%s' % non_existing_subdir], stderr=warnings) -check([non_existing_subdir]) - -test.must_not_exist(non_existing_file) -test.must_not_exist(non_existing_subdir) - - - -test.write(SConstruct_path, """\ -opts = Options(args=ARGUMENTS) -opts.AddOptions( - PathOption('X', 'X variable', r'%s', validator=PathOption.PathIsFile), - ) - -env = Environment(options=opts) - -print(env['X']) - -Default(env.Alias('dummy', None)) -""" % default_file) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* File path for option X does not exist: %(default_file_re)s -""" % locals()) + TestSCons.file_expr - -test.run(status=2, stderr=expect_stderr) - -test.write(default_file, "default_file\n") - -test.run(stderr=warnings) -check([default_file]) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* File path for option X is a directory: %(existing_subdir_re)s -""" % locals()) + TestSCons.file_expr - -test.run(arguments=['X=%s' % existing_subdir], status=2, stderr=expect_stderr) - -test.run(arguments=['X=%s' % existing_file], stderr=warnings) -check([existing_file]) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* File path for option X does not exist: %(non_existing_file_re)s -""" % locals()) + TestSCons.file_expr - -test.run(arguments=['X=%s' % non_existing_file], status=2, stderr=expect_stderr) - - - -test.write('SConstruct', """\ -opts = Options(args=ARGUMENTS) -opts.AddOptions( - PathOption('X', 'X variable', r'%s', validator=PathOption.PathIsDir), - ) - -env = Environment(options=opts) - -print(env['X']) - -Default(env.Alias('dummy', None)) -""" % default_subdir) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* Directory path for option X does not exist: %(default_subdir_re)s -""" % locals()) + TestSCons.file_expr - -test.run(status=2, stderr=expect_stderr) - -test.subdir(default_subdir) - -test.run(stderr=warnings) -check([default_subdir]) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* Directory path for option X is a file: %(existing_file_re)s -""" % locals()) + TestSCons.file_expr - -test.run(arguments=['X=%s' % existing_file], - status=2, - stderr=expect_stderr) - -test.run(arguments=['X=%s' % existing_subdir], stderr=warnings) -check([existing_subdir]) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* Directory path for option X does not exist: %(non_existing_subdir_re)s -""" % locals()) + TestSCons.file_expr - -test.run(arguments=['X=%s' % non_existing_subdir], - status=2, - stderr=expect_stderr) - - - -test.write('SConstruct', """\ -opts = Options(args=ARGUMENTS) -opts.AddOptions( - PathOption('X', 'X variable', r'%s', validator=PathOption.PathIsDirCreate), - ) - -env = Environment(options=opts) - -print(env['X']) - -Default(env.Alias('dummy', None)) -""" % default_subdir) - -test.run(stderr=warnings) -check([default_subdir]) - -expect_stderr = warnings + (""" -scons: \\*\\*\\* Path for option X is a file, not a directory: %(existing_file_re)s -""" % locals()) + TestSCons.file_expr - -test.run(arguments=['X=%s' % existing_file], status=2, stderr=expect_stderr) - -test.run(arguments=['X=%s' % existing_subdir], stderr=warnings) -check([existing_subdir]) - -test.run(arguments=['X=%s' % non_existing_subdir], stderr=warnings) -check([non_existing_subdir]) - -test.must_exist(non_existing_subdir) - - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/Options/chdir.py b/test/Deprecated/Options/chdir.py deleted file mode 100644 index bfeda1b..0000000 --- a/test/Deprecated/Options/chdir.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Verify that we can chdir() to the directory in which an Options -file lives by using the __name__ value. -""" - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -test.subdir('bin', 'subdir') - -test.write('SConstruct', """\ -opts = Options('../bin/opts.cfg', ARGUMENTS) -opts.Add('VARIABLE') -Export("opts") -SConscript('subdir/SConscript') -""") - -SConscript_contents = """\ -Import("opts") -env = Environment() -opts.Update(env) -print("VARIABLE = %s"%repr(env['VARIABLE'])) -""" - -test.write(['bin', 'opts.cfg'], """\ -import os -os.chdir(os.path.split(__name__)[0]) -exec(open('opts2.cfg', 'r').read()) -""") - -test.write(['bin', 'opts2.cfg'], """\ -VARIABLE = 'opts2.cfg value' -""") - -test.write(['subdir', 'SConscript'], SConscript_contents) - -expect = """\ -VARIABLE = 'opts2.cfg value' -""" - -warnings = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -""" + TestSCons.file_expr - -test.run(arguments = '-q -Q .', stdout=expect, stderr=warnings) - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/Options/help.py b/test/Deprecated/Options/help.py deleted file mode 100644 index ad8a96b..0000000 --- a/test/Deprecated/Options/help.py +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Test the Options help messages. -""" - -import os -import re - -import TestSCons - -str_True = str(True) -str_False = str(False) - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -workpath = test.workpath() -qtpath = os.path.join(workpath, 'qt') -libpath = os.path.join(qtpath, 'lib') -libdirvar = os.path.join('$qtdir', 'lib') - -qtpath_re = re.escape(qtpath) -libpath_re = re.escape(libpath) -libdirvar_re = re.escape(libdirvar) - -test.subdir(qtpath) -test.subdir(libpath) - -test.write('SConstruct', """ -from SCons.Options import BoolOption, EnumOption, ListOption, \ - PackageOption, PathOption - -list_of_libs = Split('x11 gl qt ical') -qtdir = r'%(qtpath)s' - -opts = Options(args=ARGUMENTS) -opts.AddOptions( - BoolOption('warnings', 'compilation with -Wall and similiar', 1), - BoolOption('profile', 'create profiling informations', 0), - EnumOption('debug', 'debug output and symbols', 'no', - allowed_values=('yes', 'no', 'full'), - map={}, ignorecase=0), # case sensitive - EnumOption('guilib', 'gui lib to use', 'gtk', - allowed_values=('motif', 'gtk', 'kde'), - map={}, ignorecase=1), # case insensitive - EnumOption('some', 'some option', 'xaver', - allowed_values=('xaver', 'eins'), - map={}, ignorecase=2), # make lowercase - ListOption('shared', - 'libraries to build as shared libraries', - 'all', - names = list_of_libs), - PackageOption('x11', - 'use X11 installed here (yes = search some places)', - 'yes'), - PathOption('qtdir', 'where the root of Qt is installed', qtdir), - PathOption('qt_libraries', - 'where the Qt library is installed', - r'%(libdirvar)s'), - ) - -env = Environment(options=opts) -Help(opts.GenerateHelpText(env)) - -print(env['warnings']) -print(env['profile']) - -Default(env.Alias('dummy', None)) -""" % locals()) - - -expected_stdout = """\ -scons: Reading SConscript files ... -%(str_True)s -%(str_False)s -scons: done reading SConscript files. - -warnings: compilation with -Wall and similiar \\(yes|no\\) - default: 1 - actual: %(str_True)s - -profile: create profiling informations \\(yes|no\\) - default: 0 - actual: %(str_False)s - -debug: debug output and symbols \\(yes|no|full\\) - default: no - actual: no - -guilib: gui lib to use \\(motif|gtk|kde\\) - default: gtk - actual: gtk - -some: some option \\(xaver|eins\\) - default: xaver - actual: xaver - -shared: libraries to build as shared libraries - \\(all|none|comma-separated list of names\\) - allowed names: x11 gl qt ical - default: all - actual: x11 gl qt ical - -x11: use X11 installed here \\(yes = search some places\\) - \\( yes | no | /path/to/x11 \\) - default: yes - actual: %(str_True)s - -qtdir: where the root of Qt is installed \\( /path/to/qtdir \\) - default: %(qtpath_re)s - actual: %(qtpath_re)s - -qt_libraries: where the Qt library is installed \\( /path/to/qt_libraries \\) - default: %(libdirvar_re)s - actual: %(libpath_re)s - -Use scons -H for help about command-line options. -""" % locals() - -file_expr = TestSCons.file_expr - -expected_stderr = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -%(file_expr)s -scons: warning: The BoolOption\\(\\) function is deprecated; use the BoolVariable\\(\\) function instead. -%(file_expr)s -scons: warning: The EnumOption\\(\\) function is deprecated; use the EnumVariable\\(\\) function instead. -%(file_expr)s -scons: warning: The ListOption\\(\\) function is deprecated; use the ListVariable\\(\\) function instead. -%(file_expr)s -scons: warning: The PackageOption\\(\\) function is deprecated; use the PackageVariable\\(\\) function instead. -%(file_expr)s -scons: warning: The PathOption\\(\\) function is deprecated; use the PathVariable\\(\\) function instead. -%(file_expr)s""" % locals() - -test.run(arguments='-h', stdout=expected_stdout, stderr=expected_stderr) - - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/Options/import.py b/test/Deprecated/Options/import.py deleted file mode 100644 index 764a061..0000000 --- a/test/Deprecated/Options/import.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Verify that an Options file in a different directory can import -a module in that directory. -""" - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -workpath = test.workpath('') - -test.subdir('bin', 'subdir') - -test.write('SConstruct', """\ -opts = Options('../bin/opts.cfg', ARGUMENTS) -opts.Add('VARIABLE') -Export("opts") -SConscript('subdir/SConscript') -""") - -SConscript_contents = """\ -Import("opts") -env = Environment() -opts.Update(env) -print("VARIABLE = %s"%env.get('VARIABLE')) -""" - -test.write(['bin', 'opts.cfg'], """\ -from local_options import VARIABLE -""" % locals()) - -test.write(['bin', 'local_options.py'], """\ -VARIABLE = 'bin/local_options.py' -""") - -test.write(['subdir', 'SConscript'], SConscript_contents) - -stdout = "VARIABLE = bin/local_options.py\n" - -stderr = """ -scons: warning: The Options class is deprecated; use the Variables class instead. -""" + TestSCons.file_expr - -test.run(arguments = '-q -Q .', stdout = stdout, stderr = stderr) - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: |