From 0196c818e85949922479a437717b15f710173cef Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 25 Sep 2018 20:10:22 -0700 Subject: Speedup Clean tests for windows --- test/Clean/Option.py | 3 ++- test/Clean/basic.py | 3 ++- test/Clean/function.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/Clean/Option.py b/test/Clean/Option.py index 6264428..f49c226 100644 --- a/test/Clean/Option.py +++ b/test/Clean/Option.py @@ -46,8 +46,9 @@ file.close() """) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES') -env = Environment(BUILDERS = { 'B' : B }) +env = Environment(tools=[], BUILDERS = { 'B' : B }) env.B(target = 'foo.out', source = 'foo.in') mode = ARGUMENTS.get('MODE') diff --git a/test/Clean/basic.py b/test/Clean/basic.py index 7c4730e..e9f0540 100644 --- a/test/Clean/basic.py +++ b/test/Clean/basic.py @@ -45,8 +45,9 @@ file.close() """) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES') -env = Environment(BUILDERS = { 'B' : B }) +env = Environment(tools=[], BUILDERS = { 'B' : B }) env.B(target = 'foo1.out', source = 'foo1.in') env.B(target = 'foo2.out', source = 'foo2.xxx') env.B(target = 'foo2.xxx', source = 'foo2.in') diff --git a/test/Clean/function.py b/test/Clean/function.py index aa53a35..7ddf727 100644 --- a/test/Clean/function.py +++ b/test/Clean/function.py @@ -51,8 +51,9 @@ subd_foon_in = os.path.join('subd', 'foon.in') subd_foox_in = os.path.join('subd', 'foox.in') test.write('SConstruct', """ +DefaultEnvironment(tools=[]) B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES') -env = Environment(BUILDERS = { 'B' : B }, FOO = 'foo2') +env = Environment(tools=[], BUILDERS = { 'B' : B }, FOO = 'foo2') env.B(target = 'foo1.out', source = 'foo1.in') env.B(target = 'foo2.out', source = 'foo2.xxx') foo2_xxx = env.B(target = 'foo2.xxx', source = 'foo2.in') -- cgit v0.12 From e3155a940ade6b04427c9dd35a6aca213a65c5c9 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 25 Sep 2018 20:31:48 -0700 Subject: Speed up Climb tests on windows --- test/Climb/explicit-parent--D.py | 3 ++- test/Climb/filename--D.py | 1 + test/Climb/filename--U.py | 1 + test/Climb/filename-u.py | 1 + test/Climb/option--D.py | 3 ++- test/Climb/option--U.py | 5 +++-- test/Climb/option-u.py | 3 ++- 7 files changed, 12 insertions(+), 5 deletions(-) diff --git a/test/Climb/explicit-parent--D.py b/test/Climb/explicit-parent--D.py index f894e33..6f669c3 100644 --- a/test/Climb/explicit-parent--D.py +++ b/test/Climb/explicit-parent--D.py @@ -36,13 +36,14 @@ test = TestSCons.TestSCons() test.subdir(['subdir']) test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) f = open(target, "wb") for src in source: f.write(open(str(src), "rb").read()) f.close() -env = Environment(BUILDERS={'Cat':Builder(action=cat)}) +env = Environment(tools=[], BUILDERS={'Cat':Builder(action=cat)}) env.Cat('f1.out', 'f1.in') f2 = env.Cat('f2.out', 'f2.in') Default(f2) diff --git a/test/Climb/filename--D.py b/test/Climb/filename--D.py index 6fea9bc..fee72f6 100644 --- a/test/Climb/filename--D.py +++ b/test/Climb/filename--D.py @@ -36,6 +36,7 @@ test = TestSCons.TestSCons() test.subdir('subdir', 'other') test.write('main.scons', """\ +DefaultEnvironment(tools=[]) print("main.scons") SConscript('subdir/sub.scons') """) diff --git a/test/Climb/filename--U.py b/test/Climb/filename--U.py index 49ccc0a..91a83f4 100644 --- a/test/Climb/filename--U.py +++ b/test/Climb/filename--U.py @@ -36,6 +36,7 @@ test = TestSCons.TestSCons() test.subdir('subdir', 'other') test.write('main.scons', """\ +DefaultEnvironment(tools=[]) print("main.scons") SConscript('subdir/sub.scons') """) diff --git a/test/Climb/filename-u.py b/test/Climb/filename-u.py index 4485c4b..006e53e 100644 --- a/test/Climb/filename-u.py +++ b/test/Climb/filename-u.py @@ -36,6 +36,7 @@ test = TestSCons.TestSCons() test.subdir('subdir', 'other') test.write('main.scons', """\ +DefaultEnvironment(tools=[]) print("main.scons") SConscript('subdir/sub.scons') """) diff --git a/test/Climb/option--D.py b/test/Climb/option--D.py index 57c0853..42b92d8 100644 --- a/test/Climb/option--D.py +++ b/test/Climb/option--D.py @@ -41,9 +41,10 @@ file.close() """) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) import SCons.Defaults B = Builder(action=r'%(_python_)s build.py $TARGET $SOURCES') -env = Environment() +env = Environment(tools=[]) env['BUILDERS']['B'] = B env.B(target = 'sub1/foo.out', source = 'sub1/foo.in') Export('env') diff --git a/test/Climb/option--U.py b/test/Climb/option--U.py index 04ab26a..c0e6e1e 100644 --- a/test/Climb/option--U.py +++ b/test/Climb/option--U.py @@ -43,8 +43,9 @@ file.close() """) test.write('SConstruct', r""" +DefaultEnvironment(tools=[]) import SCons.Defaults -env = Environment() +env = Environment(tools=[]) env['BUILDERS']['B'] = Builder(action=r'%(_python_)s build.py $TARGET $SOURCES', multi=1) Default(env.B(target = 'sub1/foo.out', source = 'sub1/foo.in')) Export('env') @@ -83,7 +84,7 @@ test.must_not_exist(test.workpath('sub2/xxx.out')) test.unlink(['sub1', 'foo.out']) test.write('SConscript', """\ -env = Environment() +env = Environment(tools=[], ) assert env.GetLaunchDir() == r'%s' """%test.workpath('sub1')) test.run(arguments = '-U', diff --git a/test/Climb/option-u.py b/test/Climb/option-u.py index eeb2ccc..21e83cf 100644 --- a/test/Climb/option-u.py +++ b/test/Climb/option-u.py @@ -41,13 +41,14 @@ test.subdir('sub1', 'sub4', ['sub4', 'dir']) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) f = open(target, "wb") for src in source: f.write(open(str(src), "rb").read()) f.close() -env = Environment() +env = Environment(tools=[]) env.Append(BUILDERS = {'Cat' : Builder(action=cat)}) env.Cat(target = 'sub1/f1a.out', source = 'sub1/f1a.in') env.Cat(target = 'sub1/f1b.out', source = 'sub1/f1b.in') -- cgit v0.12 From 8811fa184a7781acaaa906d1100c9824272552ee Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 25 Sep 2018 20:36:26 -0700 Subject: Speedup explain tests on windows --- test/explain/alias-order.py | 3 ++- test/explain/basic.py | 3 ++- test/explain/function-actions.py | 3 ++- test/explain/get_csig.py | 3 ++- test/explain/save-info.py | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/explain/alias-order.py b/test/explain/alias-order.py index 611c512..bdb8154 100644 --- a/test/explain/alias-order.py +++ b/test/explain/alias-order.py @@ -38,7 +38,8 @@ args = '--debug=explain target2.dat' test.subdir('src') test.write(['src', 'SConstruct'],""" -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) def action( source, target, env ): f = open( str(target[0]), 'wb' ) diff --git a/test/explain/basic.py b/test/explain/basic.py index ec7238e..19fc328 100644 --- a/test/explain/basic.py +++ b/test/explain/basic.py @@ -81,6 +81,7 @@ sys.exit(0) SConstruct_contents = """\ +DefaultEnvironment(tools=[]) import re include_re = re.compile(r'^include\s+(\S+)$', re.M) @@ -98,7 +99,7 @@ kscan = Scanner(name = 'kfile', cat = Builder(action = [[r'%(python)s', r'%(cat_py)s', '$TARGET', '$SOURCES']]) one_cat = Builder( action = [[r'%(python)s', r'%(cat_py)s', '$TARGET', '${SOURCES[0]}']]) -env = Environment() +env = Environment(tools=[]) env.Append(BUILDERS = {'Cat':cat, 'OneCat':one_cat}, SCANNERS = kscan) env.PrependENVPath('PATHEXT', '.PY') diff --git a/test/explain/function-actions.py b/test/explain/function-actions.py index bd3ad01..076b24e 100644 --- a/test/explain/function-actions.py +++ b/test/explain/function-actions.py @@ -38,9 +38,10 @@ test = TestSCons.TestSCons() test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) import shutil -env = Environment() +env = Environment(tools=[]) mode = int(ARGUMENTS.get('mode')) if mode: def DifferentCopy(target, source, env): diff --git a/test/explain/get_csig.py b/test/explain/get_csig.py index 8a0266a..b193797 100644 --- a/test/explain/get_csig.py +++ b/test/explain/get_csig.py @@ -39,7 +39,8 @@ test = TestSCons.TestSCons() args = "--debug=explain" test.write('SConstruct', """\ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) def action( source, target, env ): target[0].get_csig() diff --git a/test/explain/save-info.py b/test/explain/save-info.py index 048ee8d..08255e0 100644 --- a/test/explain/save-info.py +++ b/test/explain/save-info.py @@ -69,6 +69,7 @@ sys.exit(0) """) test.write(['src', 'SConstruct'], """\ +DefaultEnvironment(tools=[]) import re include_re = re.compile(r'^include\s+(\S+)$', re.M) @@ -85,7 +86,7 @@ kscan = Scanner(name = 'kfile', cat = Builder(action = r'%(_python_)s %(cat_py)s $TARGET $SOURCES') -env = Environment() +env = Environment(tools=[]) env.Append(BUILDERS = {'Cat':cat}, SCANNERS = kscan) -- cgit v0.12 From 8a2ee96a418eb01a53fa4e84d095c276cf058ed9 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 09:43:13 -0700 Subject: Speed up GetBuildFailures tests for windows --- test/GetBuildFailures/option-k.py | 1 + test/GetBuildFailures/parallel.py | 1 + test/GetBuildFailures/serial.py | 1 + 3 files changed, 3 insertions(+) diff --git a/test/GetBuildFailures/option-k.py b/test/GetBuildFailures/option-k.py index 12ae07b..28e80c8 100644 --- a/test/GetBuildFailures/option-k.py +++ b/test/GetBuildFailures/option-k.py @@ -57,6 +57,7 @@ test.write('mypass.py', contents) test.write('myfail.py', contents) test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) Command('f3', 'f3.in', r'@%(_python_)s mypass.py - f3 $TARGET $SOURCE') Command('f4', 'f4.in', r'@%(_python_)s myfail.py f3 f4 $TARGET $SOURCE') Command('f5', 'f5.in', r'@%(_python_)s myfail.py f4 f5 $TARGET $SOURCE') diff --git a/test/GetBuildFailures/parallel.py b/test/GetBuildFailures/parallel.py index f9503e0..ee8847f 100644 --- a/test/GetBuildFailures/parallel.py +++ b/test/GetBuildFailures/parallel.py @@ -73,6 +73,7 @@ test.write('mypass.py', contents) test.write('myfail.py', contents) test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) Command('f3', 'f3.in', r'@%(_python_)s mypass.py - f3 $TARGET $SOURCE') Command('f4', 'f4.in', r'@%(_python_)s myfail.py f3 f4 $TARGET $SOURCE') Command('f5', 'f5.in', r'@%(_python_)s myfail.py f4 f5 $TARGET $SOURCE') diff --git a/test/GetBuildFailures/serial.py b/test/GetBuildFailures/serial.py index 55a990f..144d8bc 100644 --- a/test/GetBuildFailures/serial.py +++ b/test/GetBuildFailures/serial.py @@ -60,6 +60,7 @@ test.write('mypass.py', contents) test.write('myfail.py', contents) test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) Command('f03', 'f03.in', r'@%(_python_)s mypass.py - f03 $TARGET $SOURCE') Command('f04', 'f04.in', r'@%(_python_)s myfail.py f03 f04 $TARGET $SOURCE') Command('f05', 'f05.in', r'@%(_python_)s myfail.py f04 f05 $TARGET $SOURCE') -- cgit v0.12 From c0f0caae5890c032a6a82e8b24124b21b3152f99 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 09:44:21 -0700 Subject: Speed up GetOption tests for windows --- test/GetOption/help.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/GetOption/help.py b/test/GetOption/help.py index 4f15fe6..f83dc54 100644 --- a/test/GetOption/help.py +++ b/test/GetOption/help.py @@ -33,6 +33,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) if GetOption('help'): print("GetOption('help') set") else: -- cgit v0.12 From 9ac18d0456d1f7a43596221b83537083f532a823 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 09:51:36 -0700 Subject: Speed up Glob tests for windows --- test/Glob/Repository.py | 3 ++- test/Glob/VariantDir.py | 5 +++-- test/Glob/basic.py | 3 ++- test/Glob/exclude.py | 3 ++- test/Glob/source.py | 3 ++- test/Glob/strings.py | 3 ++- test/Glob/subdir.py | 3 ++- test/Glob/subst.py | 3 ++- 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/test/Glob/Repository.py b/test/Glob/Repository.py index 22a7f88..3308e62 100644 --- a/test/Glob/Repository.py +++ b/test/Glob/Repository.py @@ -47,6 +47,7 @@ work_src_yyy = test.workpath('work', 'src', 'yyy') opts = "-Y " + test.workpath('repository') test.write(['repository', 'SConstruct'], """\ +DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -60,7 +61,7 @@ File('../repository/mmm.in') m = Glob('m*.in') assert str(m[0]) == 'mmm.in' -env = Environment(BUILDERS={'Build':Builder(action=cat)}) +env = Environment(tools=[], BUILDERS={'Build':Builder(action=cat)}) env.Build('aaa.out', Glob('a*.in')) env.Build('bbb.out', Glob('b*.in')) env.Build('ccc.out', Glob('c*.in')) diff --git a/test/Glob/VariantDir.py b/test/Glob/VariantDir.py index c9c1d07..3beb9ab 100644 --- a/test/Glob/VariantDir.py +++ b/test/Glob/VariantDir.py @@ -37,6 +37,7 @@ test.subdir('src') test.subdir('src/sub1') test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) VariantDir('var1', 'src') VariantDir('var2', 'src') @@ -48,7 +49,7 @@ SConscript('src/sub1/SConscript', src_dir = 'src', variant_dir = 'var3', duplica """) test.write(['src', 'SConscript'], """\ -env = Environment() +env = Environment(tools=[]) def concatenate(target, source, env): fp = open(str(target[0]), 'wb') @@ -63,7 +64,7 @@ env.Concatenate('fex.out', sorted(Glob('f*.in', exclude = 'f1.in'), key=lambda t """) test.write(['src', 'sub1', 'SConscript'], """\ -env = Environment() +env = Environment(tools=[]) def concatenate(target, source, env): fp = open(str(target[0]), 'wb') diff --git a/test/Glob/basic.py b/test/Glob/basic.py index 9afbbc6..ad998c3 100644 --- a/test/Glob/basic.py +++ b/test/Glob/basic.py @@ -33,7 +33,8 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) def concatenate(target, source, env): fp = open(str(target[0]), 'wb') diff --git a/test/Glob/exclude.py b/test/Glob/exclude.py index fe93b82..bc3e774 100644 --- a/test/Glob/exclude.py +++ b/test/Glob/exclude.py @@ -36,7 +36,8 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) def concatenate(target, source, env): fp = open(str(target[0]), 'wb') diff --git a/test/Glob/source.py b/test/Glob/source.py index f1ea566..3d40d05 100644 --- a/test/Glob/source.py +++ b/test/Glob/source.py @@ -37,7 +37,8 @@ test = TestSCons.TestSCons() test.subdir('src', 'var1', 'var2') test.write('SConstruct', """\ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) def concatenate(target, source, env): fp = open(str(target[0]), 'wb') diff --git a/test/Glob/strings.py b/test/Glob/strings.py index 3e47d10..0780ace 100644 --- a/test/Glob/strings.py +++ b/test/Glob/strings.py @@ -37,6 +37,7 @@ test = TestSCons.TestSCons() test.subdir('src') test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) VariantDir('var1', 'src') VariantDir('var2', 'src') @@ -45,7 +46,7 @@ SConscript('var2/SConscript') """) test.write(['src', 'SConscript'], """\ -env = Environment() +env = Environment(tools=[]) def concatenate(target, source, env): fp = open(str(target[0]), 'wb') diff --git a/test/Glob/subdir.py b/test/Glob/subdir.py index 6fc00f6..1227788 100644 --- a/test/Glob/subdir.py +++ b/test/Glob/subdir.py @@ -36,7 +36,8 @@ test = TestSCons.TestSCons() test.subdir('subdir') test.write('SConstruct', """\ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) def concatenate(target, source, env): fp = open(str(target[0]), 'wb') diff --git a/test/Glob/subst.py b/test/Glob/subst.py index e21da81..6a145f1 100644 --- a/test/Glob/subst.py +++ b/test/Glob/subst.py @@ -34,7 +34,8 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ -env = Environment(PATTERN = 'f*.in') +DefaultEnvironment(tools=[]) +env = Environment(tools=[], PATTERN = 'f*.in') def copy(target, source, env): fp = open(str(target[0]), 'wb') -- cgit v0.12 From c9a9dd8ad57e6257728630866a6d42b67e3a3bb8 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 09:53:48 -0700 Subject: Speed up implicit tests for windows --- test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py | 4 +++- test/implicit/asynchronous-modification.py | 3 ++- test/implicit/changed-node.py | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py b/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py index 2c9fd08..3d05fe3 100644 --- a/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py +++ b/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py @@ -64,9 +64,11 @@ extra = '' test.write('generate_build_py.py', generate_build_py_py_contents % locals()) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) generate = Builder(action = r'%(_python_)s $GENERATE $TARGET') build = Builder(action = r'$BUILD_PY $TARGET $SOURCES') -env = Environment(BUILDERS = { +env = Environment(tools=[], + BUILDERS = { 'GenerateBuild' : generate, 'BuildFile' : build, }, diff --git a/test/implicit/asynchronous-modification.py b/test/implicit/asynchronous-modification.py index fac8ef5..90a6392 100644 --- a/test/implicit/asynchronous-modification.py +++ b/test/implicit/asynchronous-modification.py @@ -39,7 +39,8 @@ test = TestSCons.TestSCons() test.write(['SConstruct'], """\ import SCons.Defaults -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) env['BUILDERS']['C'] = Builder(action = Copy('$TARGET', '$SOURCE'), source_scanner = SCons.Defaults.CScan) env['BUILDERS']['Mod'] = Builder(action = r'%(_python_)s mod.py') diff --git a/test/implicit/changed-node.py b/test/implicit/changed-node.py index 4f879c0..8b818ba 100644 --- a/test/implicit/changed-node.py +++ b/test/implicit/changed-node.py @@ -40,6 +40,7 @@ test.subdir('d', ['d', '3']) test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) SetOption('implicit_cache', 1) SetOption('max_drift', 1) -- cgit v0.12 From a5a1c40c8aaa71574cf4a439e1f5d742aef9103a Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 10:01:47 -0700 Subject: Speed up implicit-cache tests for windows --- test/implicit-cache/DualTargets.py | 3 ++- test/implicit-cache/GetOption.py | 2 ++ test/implicit-cache/RemoveImplicitDep.py | 3 ++- test/implicit-cache/SetOption.py | 1 + test/implicit-cache/basic.py | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/implicit-cache/DualTargets.py b/test/implicit-cache/DualTargets.py index 45174ea..8612d1a 100644 --- a/test/implicit-cache/DualTargets.py +++ b/test/implicit-cache/DualTargets.py @@ -34,6 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) import os.path def emitter(target, source, env): @@ -49,7 +50,7 @@ def source_scan(node, env, path): return [base + '.lib'] -env = Environment() +env = Environment(tools=[]) env['BUILDERS']['DualTarget'] = Builder( action = Action( [ diff --git a/test/implicit-cache/GetOption.py b/test/implicit-cache/GetOption.py index 818784a..561c21b 100644 --- a/test/implicit-cache/GetOption.py +++ b/test/implicit-cache/GetOption.py @@ -34,6 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ +DefaultEnvironment(tools=[]) assert not GetOption('implicit_cache') SetOption('implicit_cache', 1) assert GetOption('implicit_cache') @@ -42,6 +43,7 @@ assert GetOption('implicit_cache') test.run() test.write('SConstruct', """ +DefaultEnvironment(tools=[]) assert GetOption('implicit_cache') SetOption('implicit_cache', 0) assert GetOption('implicit_cache') diff --git a/test/implicit-cache/RemoveImplicitDep.py b/test/implicit-cache/RemoveImplicitDep.py index 6a9b873..c65dfec 100644 --- a/test/implicit-cache/RemoveImplicitDep.py +++ b/test/implicit-cache/RemoveImplicitDep.py @@ -37,11 +37,12 @@ test = TestSCons.TestSCons() test.subdir(['src']) SConstruct_contents = """\ +DefaultEnvironment(tools=[]) import SCons.Script SetOption( 'implicit_cache', 1 ) -env = Environment() +env = Environment(tools=[]) act = Action([Touch('${TARGETS[0]}'),Touch('${TARGETS[1]}')]) env.Append(BUILDERS = {'BuildMe':Builder(action=act,source_scanner=SCons.Script.SourceFileScanner)} ) diff --git a/test/implicit-cache/SetOption.py b/test/implicit-cache/SetOption.py index 41a7fb6..f86ad47 100644 --- a/test/implicit-cache/SetOption.py +++ b/test/implicit-cache/SetOption.py @@ -36,6 +36,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ +DefaultEnvironment(tools=[]) SetOption('implicit_cache', 1) env=Environment(CPPPATH=['i1', 'i2']) env.Object('foo.c') diff --git a/test/implicit-cache/basic.py b/test/implicit-cache/basic.py index a3a6546..b7cd984 100644 --- a/test/implicit-cache/basic.py +++ b/test/implicit-cache/basic.py @@ -53,6 +53,7 @@ test = TestSCons.TestSCons() test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2') test.write('SConstruct', """ +DefaultEnvironment(tools=[]) env = Environment(CPPPATH = Split('inc2 include')) obj = env.Object(target='prog', source='subdir/prog.c') env.Program(target='prog', source=obj) -- cgit v0.12 From ce9f09c5b8fa72b63e0f22cccb454430ef83f45f Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 10:09:28 -0700 Subject: Speed up Install tests for windows --- test/Install/Clone.py | 1 + test/Install/INSTALLSTR.py | 3 ++- test/Install/Install.py | 3 ++- test/Install/InstallAs.py | 3 ++- test/Install/dir-exists.py | 1 + test/Install/directories.py | 4 +++- test/Install/multi-dir/src/SConstruct | 3 ++- test/Install/multi.py | 3 ++- test/Install/no-top-relative.py | 3 ++- test/Install/non-ascii-name.py | 1 + test/Install/option--install-sandbox.py | 3 ++- test/Install/tool.py | 1 + test/Install/wrap-by-attribute.py | 3 ++- 13 files changed, 23 insertions(+), 9 deletions(-) diff --git a/test/Install/Clone.py b/test/Install/Clone.py index da66157..14e0688 100644 --- a/test/Install/Clone.py +++ b/test/Install/Clone.py @@ -34,6 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ +DefaultEnvironment(tools=[]) env1 = Environment(DESTDIR='sub1', tools=[]) # Call env1.Install() but not env1.InstallAs() *before* we clone it. diff --git a/test/Install/INSTALLSTR.py b/test/Install/INSTALLSTR.py index 0cc5fce..145b81d 100644 --- a/test/Install/INSTALLSTR.py +++ b/test/Install/INSTALLSTR.py @@ -37,7 +37,8 @@ test = TestSCons.TestSCons() test.subdir('install') test.write('SConstruct', """\ -env = Environment(INSTALLSTR = 'INSTALL $SOURCE => $TARGET!') +DefaultEnvironment(tools=[]) +env = Environment(tools=[], INSTALLSTR = 'INSTALL $SOURCE => $TARGET!') env.Install('install', 'file') """) diff --git a/test/Install/Install.py b/test/Install/Install.py index 72a7545..da97d2a 100644 --- a/test/Install/Install.py +++ b/test/Install/Install.py @@ -48,6 +48,7 @@ f6_sep = f6_txt.replace(os.sep, '/') _SUBDIR_f4_out = os.path.join('$SUBDIR', 'f4.out') test.write(['work', 'SConstruct'], """\ +DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) f = open(target, "w") @@ -60,7 +61,7 @@ def my_install(dest, source, env): shutil.copy2(source, dest) open('my_install.out', 'a').write(dest) -env1 = Environment() +env1 = Environment(tools=[]) env1.Append(BUILDERS={'Cat':Builder(action=cat)}) env3 = env1.Clone(INSTALL = my_install) diff --git a/test/Install/InstallAs.py b/test/Install/InstallAs.py index 537ea3a..47ee9f6 100644 --- a/test/Install/InstallAs.py +++ b/test/Install/InstallAs.py @@ -47,7 +47,8 @@ _SUBDIR_file3_in = os.path.join('$SUBDIR', 'file3.in') # test.write('SConstruct', r""" -env = Environment(INSTALLDIR=r'%(install)s', SUBDIR='subdir') +DefaultEnvironment(tools=[]) +env = Environment(tools=[], INSTALLDIR=r'%(install)s', SUBDIR='subdir') InstallAs(r'%(install_file1_out)s', 'file1.in') env.InstallAs([r'%(_INSTALLDIR_file2_out)s', r'%(install_file3_out)s'], ['file2.in', r'%(_SUBDIR_file3_in)s']) diff --git a/test/Install/dir-exists.py b/test/Install/dir-exists.py index f981a35..9882d22 100644 --- a/test/Install/dir-exists.py +++ b/test/Install/dir-exists.py @@ -35,6 +35,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) Execute(Mkdir('a')) Execute(Mkdir('b')) f=Command('a/f', None, 'echo hi > $TARGET') diff --git a/test/Install/directories.py b/test/Install/directories.py index 74a7ac5..3ebc713 100644 --- a/test/Install/directories.py +++ b/test/Install/directories.py @@ -46,10 +46,12 @@ test.subdir('outside', ['work', 'dir4', 'sub']) test.write(['work', 'SConstruct'], """\ +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) + Install('../outside', 'dir1') InstallAs('../outside/d2', 'dir2') -env = Environment() env.Install('../outside', 'dir3') env.InstallAs('../outside/d4', 'dir4') """) diff --git a/test/Install/multi-dir/src/SConstruct b/test/Install/multi-dir/src/SConstruct index e10ec8d..05b46a9 100644 --- a/test/Install/multi-dir/src/SConstruct +++ b/test/Install/multi-dir/src/SConstruct @@ -2,7 +2,8 @@ # outside the source tree can cause SCons to fail to create the dest # dir. import os, os.path, shutil -env=Environment() +DefaultEnvironment(tools=[]) +env=Environment(tools=[]) dst='../build' env.Install(os.path.join(dst,'__foo/bar/baz'), 'a') env.Install(os.path.join(dst,'__foo/bar/baz/a/b'), 'x/y') diff --git a/test/Install/multi.py b/test/Install/multi.py index a7a6eb8..1716d17 100644 --- a/test/Install/multi.py +++ b/test/Install/multi.py @@ -34,7 +34,8 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) env.Install('install', 'file1') env.Install('install', 'file1') """) diff --git a/test/Install/no-top-relative.py b/test/Install/no-top-relative.py index 3eb24f7..31c7130 100644 --- a/test/Install/no-top-relative.py +++ b/test/Install/no-top-relative.py @@ -39,7 +39,8 @@ test = TestSCons.TestSCons() test.subdir(['test']) test.write(['SConstruct'], """\ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) i = env.Install("#/install", "#/test/#testfile.txt#"); env.Default(i); """) diff --git a/test/Install/non-ascii-name.py b/test/Install/non-ascii-name.py index 186af09..462040d 100644 --- a/test/Install/non-ascii-name.py +++ b/test/Install/non-ascii-name.py @@ -39,6 +39,7 @@ test.write('中文.txt', "test stuff here in file 中文.txt.\n") test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) InstallAs("b", Glob("*.txt")) """) test.run(arguments='.') diff --git a/test/Install/option--install-sandbox.py b/test/Install/option--install-sandbox.py index 020cd3a..45366c1 100644 --- a/test/Install/option--install-sandbox.py +++ b/test/Install/option--install-sandbox.py @@ -49,7 +49,8 @@ file1_out = target+os.path.join( target, # test.write('SConstruct', r""" -env = Environment(SUBDIR='subdir') +DefaultEnvironment(tools=[]) +env = Environment(tools=[], SUBDIR='subdir') f1 = env.Install(r'%(destdir)s', 'file1.out') f2 = env.InstallAs(['file2.out', r'%(_SUBDIR_file3_out)s'], ['file2.in', r'%(_SUBDIR_file3_in)s']) diff --git a/test/Install/tool.py b/test/Install/tool.py index 1e49584..ba92d0a 100644 --- a/test/Install/tool.py +++ b/test/Install/tool.py @@ -36,6 +36,7 @@ test = TestSCons.TestSCons() test.subdir('iii') test.write('SConstruct', """ +DefaultEnvironment(tools=[]) env = Environment(tools = []) env.Install('iii', 'foo.in') env.InstallAs('foo.out', 'foo.in') diff --git a/test/Install/wrap-by-attribute.py b/test/Install/wrap-by-attribute.py index 02513af..6989fa8 100644 --- a/test/Install/wrap-by-attribute.py +++ b/test/Install/wrap-by-attribute.py @@ -42,6 +42,7 @@ test = TestSCons.TestSCons() test.subdir('outside', 'sub') test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) import os.path def cat(env, source, target): @@ -51,7 +52,7 @@ def cat(env, source, target): f.write(open(str(src), "rb").read()) f.close() -env = Environment(DESTDIR='dest') +env = Environment(tools=[], DESTDIR='dest') env.Append(BUILDERS={'Cat':Builder(action=cat)}) env.SconsInternalInstallFunc = env.Install -- cgit v0.12 From dc4ff77f81747174ad99956fef601dbd540eed3f Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 10:34:43 -0700 Subject: Speed up import.py by excluding default tool installs when not needed for windows --- test/import.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/import.py b/test/import.py index 11fee9c..9799850 100644 --- a/test/import.py +++ b/test/import.py @@ -63,6 +63,7 @@ platforms = [ for platform in platforms: test.write('SConstruct', """ +DefaultEnvironment(tools=[]) print("Platform %(platform)s") env = Environment(platform = '%(platform)s', tools=[]) import SCons.Platform.%(platform)s @@ -152,22 +153,24 @@ error_output = { # An SConstruct for importing Tool names that have illegal characters # for Python variable names. indirect_import = """\ +DefaultEnvironment(tools=[]) print("Tool %(tool)s (indirect)") env = Environment(tools = ['%(tool)s']) SCons = __import__('SCons.Tool.%(tool)s', globals(), locals(), []) m = getattr(SCons.Tool, '%(tool)s') -env = Environment() +env = Environment(tools=[]) m.generate(env) """ # An SConstruct for importing Tool names "normally." direct_import = """\ +DefaultEnvironment(tools=[]) print("Tool %(tool)s (direct)") env = Environment(tools = ['%(tool)s']) import SCons.Tool.%(tool)s -env = Environment() +env = Environment(tools=[]) SCons.Tool.%(tool)s.exists(env) SCons.Tool.%(tool)s.generate(env) """ -- cgit v0.12 From 981388a605495675d79b18c1eb63d885fae2470d Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 10:38:32 -0700 Subject: Speed up long-lines tests for windows --- test/long-lines/signature.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/long-lines/signature.py b/test/long-lines/signature.py index ce38bec..af234a3 100644 --- a/test/long-lines/signature.py +++ b/test/long-lines/signature.py @@ -54,11 +54,13 @@ fp.write('TIMESTAMP=%s\\n' % args[3]) os.chmod(build_py, 0o755) test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) arg = 'a_long_ignored_argument' extra_arguments = arg while len(extra_arguments) <= 1024: extra_arguments = extra_arguments + ' ' + arg -env = Environment(FILECOM=[r'%(build_py)s', +env = Environment(tools=[], + FILECOM=[r'%(build_py)s', '$TARGET', '$SOURCE', '$FILEFLAG', '$(', '$TIMESTAMP', '$)', -- cgit v0.12 From 8fca42cbacd48d6f832721363813d9b3d1e3163d Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 10:42:18 -0700 Subject: Speed up M4 tests for windows --- test/M4/M4.py | 8 +++++--- test/M4/M4COM.py | 3 ++- test/M4/M4COMSTR.py | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/test/M4/M4.py b/test/M4/M4.py index 76010e6..82c084c 100644 --- a/test/M4/M4.py +++ b/test/M4/M4.py @@ -46,7 +46,8 @@ sys.exit(0) """) test.write('SConstruct', """ -env = Environment(tools=['default', 'm4'], +DefaultEnvironment(tools=[]) +env = Environment(tools=['m4'], M4 = r'%(_python_)s mym4.py') env.M4(target = 'aaa.x', source = 'aaa.x.m4') """ % locals()) @@ -76,10 +77,11 @@ if m4: test.file_fixture('wrapper.py') test.write('SConstruct', """ -foo = Environment(tools=['default', 'm4'], +DefaultEnvironment(tools=[]) +foo = Environment(tools=['m4'], M4=r'%(m4)s', M4FLAGS='-DFFF=fff') m4 = foo.Dictionary('M4') -bar = Environment(tools=['default', 'm4'], +bar = Environment(tools=['m4'], M4 = r'%(_python_)s wrapper.py ' + m4, M4FLAGS='-DBBB=bbb') foo.M4(target = 'foo.x', source = 'foo.x.m4') bar.M4(target = 'bar', source = 'bar.m4') diff --git a/test/M4/M4COM.py b/test/M4/M4COM.py index 5a2f076..4e95419 100644 --- a/test/M4/M4COM.py +++ b/test/M4/M4COM.py @@ -47,7 +47,8 @@ sys.exit(0) """) test.write('SConstruct', """ -env = Environment(tools=['default', 'm4'], +DefaultEnvironment(tools=[]) +env = Environment(tools=['m4'], M4COM = r'%(_python_)s mym4.py $TARGET $SOURCES') env.M4(target = 'aaa.out', source = 'aaa.in') """ % locals()) diff --git a/test/M4/M4COMSTR.py b/test/M4/M4COMSTR.py index da01e6c..0e6725b 100644 --- a/test/M4/M4COMSTR.py +++ b/test/M4/M4COMSTR.py @@ -48,7 +48,8 @@ sys.exit(0) """) test.write('SConstruct', """ -env = Environment(tools=['default', 'm4'], +DefaultEnvironment(tools=[]) +env = Environment(tools=['m4'], M4COM = r'%(_python_)s mym4.py $TARGET $SOURCES', M4COMSTR = 'M4ing $TARGET from $SOURCE') env.M4(target = 'aaa.out', source = 'aaa.in') -- cgit v0.12 From db67204cfdb270dbc08f36813e20c0a41c225b25 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 26 Sep 2018 11:03:34 -0700 Subject: Speed up option tests for windows --- test/option/d.py | 3 ++- test/option/debug-count.py | 1 + test/option/debug-duplicate.py | 3 ++- test/option/debug-findlibs.py | 1 + test/option/debug-includes.py | 1 + test/option/debug-memoizer.py | 3 ++- test/option/debug-memory.py | 3 ++- test/option/debug-multiple.py | 1 + test/option/debug-objects.py | 3 ++- test/option/debug-pdb.py | 3 ++- test/option/debug-prepare.py | 3 ++- test/option/debug-presub.py | 4 +++- test/option/debug-stacktrace.py | 3 ++- test/option/debug-time.py | 4 +++- test/option/environment-overrides.py | 2 +- test/option/help-options.py | 2 +- test/option/md5-chunksize.py | 6 ++++-- test/option/no-print-directory.py | 2 +- test/option/option_profile.py | 1 + test/option/print-directory.py | 2 +- test/option/repository.py | 3 ++- test/option/srcdir.py | 3 ++- test/option/stack-size.py | 3 ++- test/option/taskmastertrace.py | 3 ++- test/option/tree-all.py | 1 + test/option/tree-derived.py | 1 + test/option/tree-lib.py | 1 + test/option/warn-dependency.py | 3 ++- test/option/warn-duplicate-environment.py | 3 ++- test/option/warn-misleading-keywords.py | 3 ++- test/option/warn-missing-sconscript.py | 3 ++- 31 files changed, 54 insertions(+), 24 deletions(-) diff --git a/test/option/d.py b/test/option/d.py index 055769a..36be02b 100644 --- a/test/option/d.py +++ b/test/option/d.py @@ -32,7 +32,7 @@ import TestSCons test = TestSCons.TestSCons() -test.write('SConstruct', "") +test.write('SConstruct', "DefaultEnvironment(tools=[])\n") test.run(arguments = '-d .', stderr = "Warning: ignoring -d option\n") @@ -44,6 +44,7 @@ test.pass_test() test.subdir('subdir') test.write('SConstruct', """ +DefaultEnvironment(tools=[]) env = Environment() env.Program(target = 'aaa', source = 'aaa.c') env.Program(target = 'bbb', source = 'bbb.c') diff --git a/test/option/debug-count.py b/test/option/debug-count.py index b82a434..2b5b745 100644 --- a/test/option/debug-count.py +++ b/test/option/debug-count.py @@ -44,6 +44,7 @@ except ImportError: test.write('SConstruct', """ +DefaultEnvironment(tools=[]) def cat(target, source, env): open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) env = Environment(BUILDERS={'Cat':Builder(action=Action(cat))}) diff --git a/test/option/debug-duplicate.py b/test/option/debug-duplicate.py index df2723e..8b9810d 100644 --- a/test/option/debug-duplicate.py +++ b/test/option/debug-duplicate.py @@ -33,7 +33,8 @@ test = TestSCons.TestSCons() test.subdir('sub1') test.write('SConstruct', """\ -env=Environment() +DefaultEnvironment(tools=[]) +env=Environment(tools=[]) Export('env') env.SConscript('SConscript', variant_dir='Build') """) diff --git a/test/option/debug-findlibs.py b/test/option/debug-findlibs.py index 9d5c82a..78ecee9 100644 --- a/test/option/debug-findlibs.py +++ b/test/option/debug-findlibs.py @@ -42,6 +42,7 @@ ofp.close() """) test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx', LIBPATH = ['sub1', 'sub2', '.'], LIBS = ['iii', 'jjj', 'kkk', 'lll', 'mmm'], diff --git a/test/option/debug-includes.py b/test/option/debug-includes.py index 0982a20..e5c8e0a 100644 --- a/test/option/debug-includes.py +++ b/test/option/debug-includes.py @@ -34,6 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ +DefaultEnvironment(tools=[]) env = Environment(OBJSUFFIX = '.obj', SHOBJSUFFIX = '.shobj', LIBPREFIX = '', diff --git a/test/option/debug-memoizer.py b/test/option/debug-memoizer.py index 222ba67..f65bcb8 100644 --- a/test/option/debug-memoizer.py +++ b/test/option/debug-memoizer.py @@ -36,9 +36,10 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) def cat(target, source, env): open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) -env = Environment(BUILDERS={'Cat':Builder(action=Action(cat))}) +env = Environment(tools=[], BUILDERS={'Cat':Builder(action=Action(cat))}) env.Cat('file.out', 'file.in') """) diff --git a/test/option/debug-memory.py b/test/option/debug-memory.py index c9165ed..6d395d6 100644 --- a/test/option/debug-memory.py +++ b/test/option/debug-memory.py @@ -47,9 +47,10 @@ except ImportError: test.write('SConstruct', """ +DefaultEnvironment(tools=[]) def cat(target, source, env): open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) -env = Environment(BUILDERS={'Cat':Builder(action=Action(cat))}) +env = Environment(tools=[], BUILDERS={'Cat':Builder(action=Action(cat))}) env.Cat('file.out', 'file.in') """) diff --git a/test/option/debug-multiple.py b/test/option/debug-multiple.py index f121a2c..23af13b 100644 --- a/test/option/debug-multiple.py +++ b/test/option/debug-multiple.py @@ -36,6 +36,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ +DefaultEnvironment(tools=[]) def cat(target, source, env): open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) env = Environment(BUILDERS={'Cat':Builder(action=Action(cat))}) diff --git a/test/option/debug-objects.py b/test/option/debug-objects.py index 6a919a4..e86684a 100644 --- a/test/option/debug-objects.py +++ b/test/option/debug-objects.py @@ -41,9 +41,10 @@ except ImportError: test.write('SConstruct', """ +DefaultEnvironment(tools=[]) def cat(target, source, env): open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) -env = Environment(BUILDERS={'Cat':Builder(action=Action(cat))}) +env = Environment(tools=[], BUILDERS={'Cat':Builder(action=Action(cat))}) env.Cat('file.out', 'file.in') """) diff --git a/test/option/debug-pdb.py b/test/option/debug-pdb.py index d4d285c..ec303a5 100644 --- a/test/option/debug-pdb.py +++ b/test/option/debug-pdb.py @@ -29,7 +29,8 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) """) test.run(arguments = "--debug=pdb", stdin = "n\ns\nq\n") diff --git a/test/option/debug-prepare.py b/test/option/debug-prepare.py index 350c352..0ed95f9 100644 --- a/test/option/debug-prepare.py +++ b/test/option/debug-prepare.py @@ -31,7 +31,8 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() test.write('SConstruct', """\ -env=Environment() +DefaultEnvironment(tools=[]) +env=Environment(tools=[]) dest=env.Command('foo.out', 'SConstruct', [Copy('$TARGET', '$SOURCE'), Copy('${TARGET}.extra', '$SOURCE')]) diff --git a/test/option/debug-presub.py b/test/option/debug-presub.py index 28eeb83..0b0555a 100644 --- a/test/option/debug-presub.py +++ b/test/option/debug-presub.py @@ -37,6 +37,7 @@ sys.exit(0) """) test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -47,7 +48,8 @@ FILE = Builder(action="$FILECOM") TEMP = Builder(action="$TEMPCOM") LIST = Builder(action="$LISTCOM") FUNC = Builder(action=cat) -env = Environment(PYTHON=r'%(_python_)s', +env = Environment(tools=[], + PYTHON=r'%(_python_)s', BUILDERS = {'FILE':FILE, 'TEMP':TEMP, 'LIST':LIST, 'FUNC':FUNC}, FILECOM="$PYTHON cat.py $SOURCES $TARGET", TEMPCOM="$PYTHON cat.py $SOURCES temp\\n$PYTHON cat.py temp $TARGET", diff --git a/test/option/debug-stacktrace.py b/test/option/debug-stacktrace.py index fcc4c1b..490fecf 100644 --- a/test/option/debug-stacktrace.py +++ b/test/option/debug-stacktrace.py @@ -33,6 +33,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) def kfile_scan(node, env, target): raise Exception("kfile_scan error") @@ -40,7 +41,7 @@ kscan = Scanner(name = 'kfile', function = kfile_scan, skeys = ['.k']) -env = Environment() +env = Environment(tools=[]) env.Append(SCANNERS = [kscan]) env.Command('foo', 'foo.k', Copy('$TARGET', '$SOURCE')) diff --git a/test/option/debug-time.py b/test/option/debug-time.py index 7dd17fe..987e49f 100644 --- a/test/option/debug-time.py +++ b/test/option/debug-time.py @@ -44,7 +44,9 @@ sys.exit(0) """) test.write('SConstruct', """ -env = Environment(PYTHON = r'%(_python_)s', +DefaultEnvironment(tools=[]) +env = Environment(tools=[], + PYTHON = r'%(_python_)s', SLEEP_CAT = r'sleep_cat.py', CATCOM = '$PYTHON $SLEEP_CAT $SECONDS $TARGET $SOURCES', SECONDS = ARGUMENTS.get('SLEEP', '0')) diff --git a/test/option/environment-overrides.py b/test/option/environment-overrides.py index 8680e2c..fe2ac24 100644 --- a/test/option/environment-overrides.py +++ b/test/option/environment-overrides.py @@ -32,7 +32,7 @@ import TestSCons test = TestSCons.TestSCons() -test.write('SConstruct', "") +test.write('SConstruct', "DefaultEnvironment(tools=[])\n") test.run(arguments = '-e .', stderr = "Warning: ignoring -e option\n") diff --git a/test/option/help-options.py b/test/option/help-options.py index e14eff2..1835a62 100644 --- a/test/option/help-options.py +++ b/test/option/help-options.py @@ -34,7 +34,7 @@ import TestSCons test = TestSCons.TestSCons() -test.write('SConstruct', "") +test.write('SConstruct', "DefaultEnvironment(tools=[])\n") test.run(arguments = '-H') diff --git a/test/option/md5-chunksize.py b/test/option/md5-chunksize.py index dbb2615..708143f 100644 --- a/test/option/md5-chunksize.py +++ b/test/option/md5-chunksize.py @@ -39,9 +39,10 @@ file.close() """) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) SetOption('md5_chunksize', 128) B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES') -env = Environment(BUILDERS = { 'B' : B }) +env = Environment(tools=[], BUILDERS = { 'B' : B }) f1 = env.B(target = 'f1.out', source = 'f1.in') f2 = env.B(target = 'f2.out', source = 'f2.in') Requires(f2, f1) @@ -102,13 +103,14 @@ get_stat(["test.stat"], ["test.big"]) """) test2.write('SConstruct', """ +DefaultEnvironment(tools=[]) import os def get_stat(target, source, env): stat = os.stat(source[0].get_abspath()) dest = open(target[0].get_abspath(),'w') dest.write(str(stat)) dest.close() -env = Environment() +env = Environment(tools=[]) env.Command('test.big', 'SConstruct', 'dd if=/dev/zero of=test.big seek=100 bs=1M count=0 2>/dev/null') env.AlwaysBuild('test.big') env.Command('test.stat', 'test.big', Action(get_stat)) diff --git a/test/option/no-print-directory.py b/test/option/no-print-directory.py index 850a484..2a5857e 100644 --- a/test/option/no-print-directory.py +++ b/test/option/no-print-directory.py @@ -32,7 +32,7 @@ import TestSCons test = TestSCons.TestSCons() -test.write('SConstruct', "") +test.write('SConstruct', "DefaultEnvironment(tools=[])\n") test.run(arguments = '--no-print-directory .', stderr = "Warning: ignoring --no-print-directory option\n") diff --git a/test/option/option_profile.py b/test/option/option_profile.py index cb9d22c..4538e0e 100644 --- a/test/option/option_profile.py +++ b/test/option/option_profile.py @@ -48,6 +48,7 @@ except ImportError: test.skip_test('No pstats module, skipping test.\n') test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) Command('file.out', 'file.in', Copy("$TARGET", "$SOURCE")) """) diff --git a/test/option/print-directory.py b/test/option/print-directory.py index 96d9d7b..79d81d9 100644 --- a/test/option/print-directory.py +++ b/test/option/print-directory.py @@ -32,7 +32,7 @@ import TestSCons test = TestSCons.TestSCons() -test.write('SConstruct', "") +test.write('SConstruct', "DefaultEnvironment(tools=[])\n") test.run(arguments = '-w .', stderr = "Warning: ignoring -w option\n") diff --git a/test/option/repository.py b/test/option/repository.py index a71e71e..392c421 100644 --- a/test/option/repository.py +++ b/test/option/repository.py @@ -37,7 +37,8 @@ test.subdir('repository', 'work1') repository = test.workpath('repository') test.write(['repository', 'SConstruct'], """\ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) env.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) """) diff --git a/test/option/srcdir.py b/test/option/srcdir.py index 0a92f13..15c8f95 100644 --- a/test/option/srcdir.py +++ b/test/option/srcdir.py @@ -37,7 +37,8 @@ test.subdir('repository', 'work1') repository = test.workpath('repository') test.write(['repository', 'SConstruct'], r""" -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) env.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) """) diff --git a/test/option/stack-size.py b/test/option/stack-size.py index 3d7a715..febec5a 100644 --- a/test/option/stack-size.py +++ b/test/option/stack-size.py @@ -49,8 +49,9 @@ file.close() test.write(['work1', 'SConstruct'], """ +DefaultEnvironment(tools=[]) B = Builder(action = r'%(_python_)s ../build.py $TARGETS $SOURCES') -env = Environment(BUILDERS = { 'B' : B }) +env = Environment(tools=[], BUILDERS = { 'B' : B }) f1 = env.B(target = 'f1.out', source = 'f1.in') f2 = env.B(target = 'f2.out', source = 'f2.in') Requires(f2, f1) diff --git a/test/option/taskmastertrace.py b/test/option/taskmastertrace.py index c426692..b38645f 100644 --- a/test/option/taskmastertrace.py +++ b/test/option/taskmastertrace.py @@ -33,7 +33,8 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) # We name the files 'Tfile' so that they will sort after the SConstruct # file regardless of whether the test is being run on a case-sensitive diff --git a/test/option/tree-all.py b/test/option/tree-all.py index fc0f689..6222ba1 100644 --- a/test/option/tree-all.py +++ b/test/option/tree-all.py @@ -39,6 +39,7 @@ LINK = test.detect('LINK') if LINK is None: LINK = CC test.write('SConstruct', """ +DefaultEnvironment(tools=[]) env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx') env.Program('Foo', Split('Foo.c Bar.c')) """) diff --git a/test/option/tree-derived.py b/test/option/tree-derived.py index 8490612..84d30fc 100644 --- a/test/option/tree-derived.py +++ b/test/option/tree-derived.py @@ -34,6 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ +DefaultEnvironment(tools=[]) env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx') env.Program('foo', Split('foo.c bar.c')) """) diff --git a/test/option/tree-lib.py b/test/option/tree-lib.py index 4725d42..1e6df02 100644 --- a/test/option/tree-lib.py +++ b/test/option/tree-lib.py @@ -38,6 +38,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ +DefaultEnvironment(tools=[]) env = Environment(LIBPREFIX='', LIBSUFFIX='.lib', OBJSUFFIX='.obj', diff --git a/test/option/warn-dependency.py b/test/option/warn-dependency.py index ca0c2aa..dca3815 100644 --- a/test/option/warn-dependency.py +++ b/test/option/warn-dependency.py @@ -34,12 +34,13 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write("SConstruct", """\ +DefaultEnvironment(tools=[]) import SCons.Defaults def build(target, source, env): pass -env=Environment() +env=Environment(tools=[]) env['BUILDERS']['test'] = Builder(action=build, source_scanner=SCons.Defaults.ObjSourceScan) env.test(target='foo', source='foo.c') diff --git a/test/option/warn-duplicate-environment.py b/test/option/warn-duplicate-environment.py index 09ced2d..1509e41 100644 --- a/test/option/warn-duplicate-environment.py +++ b/test/option/warn-duplicate-environment.py @@ -34,6 +34,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) def build(env, target, source): file = open(str(target[0]), 'wb') for s in source: @@ -44,7 +45,7 @@ if WARN: SetOption('warn', WARN) B = Builder(action=build, multi=1) -env = Environment(BUILDERS = { 'B' : B }) +env = Environment(tools=[], BUILDERS = { 'B' : B }) env2 = env.Clone(DIFFERENT_VARIABLE = 'true') env.B(target = 'file1.out', source = 'file1a.in') env2.B(target = 'file1.out', source = 'file1b.in') diff --git a/test/option/warn-misleading-keywords.py b/test/option/warn-misleading-keywords.py index 67bc965..ca934e5 100644 --- a/test/option/warn-misleading-keywords.py +++ b/test/option/warn-misleading-keywords.py @@ -34,6 +34,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """ +DefaultEnvironment(tools=[]) def build(env, target, source): file = open(str(target[0]), 'wb') for s in source: @@ -44,7 +45,7 @@ if WARN: SetOption('warn', WARN) B = Builder(action=build, multi=1) -env = Environment(BUILDERS = { 'B' : B }) +env = Environment(tools=[], BUILDERS = { 'B' : B }) env.B(targets = 'file3a.out', source = 'file3a.in') env.B(target = 'file3b.out', sources = 'file3b.in') """) diff --git a/test/option/warn-missing-sconscript.py b/test/option/warn-missing-sconscript.py index 492131b..f5e697b 100644 --- a/test/option/warn-missing-sconscript.py +++ b/test/option/warn-missing-sconscript.py @@ -34,10 +34,11 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write("SConstruct", """\ +DefaultEnvironment(tools=[]) def build(target, source, env): pass -env=Environment() +env=Environment(tools=[]) env['BUILDERS']['test'] = Builder(action=build) env.test(target='foo', source='foo.c') WARN = ARGUMENTS.get('WARN') -- cgit v0.12 From 00a71297271f35b1f313b132d7a5de9edcee1271 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 3 Oct 2018 11:58:21 -0600 Subject: Resync generated docs There have been a few doc changes since 3.0.1, this commit resyncs the generated docs to pick up fixes and wording. No code or test effect. Signed-off-by: Mats Wichmann --- doc/generated/builders.gen | 12 +-- doc/generated/examples/caching_ex-random_1.xml | 2 +- doc/generated/examples/environments_ex3_1.xml | 22 +----- doc/generated/examples/java_jar1_1.xml | 2 +- .../examples/troubleshoot_stacktrace_2.xml | 2 +- doc/generated/functions.gen | 19 ++++- doc/generated/variables.gen | 89 +++++++++++++++------- doc/generated/variables.mod | 2 + src/engine/SCons/Tool/packaging/__init__.xml | 2 +- 9 files changed, 93 insertions(+), 59 deletions(-) diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index d851c93..ada4e43 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -1206,13 +1206,15 @@ the following packagers available: * msi - Microsoft Installer - * rpm - Redhat Package Manger + * rpm - RPM Package Manger * ipkg - Itsy Package Management System - * tarbz2 - compressed tar - * targz - compressed tar + * tarbz2 - bzip2 compressed tar + * targz - gzip compressed tar + * tarxz - xz compressed tar * zip - zip file - * src_tarbz2 - compressed tar source - * src_targz - compressed tar source + * src_tarbz2 - bzip2 compressed tar source + * src_targz - gzip compressed tar source + * src_tarxz - xz compressed tar source * src_zip - zip file source diff --git a/doc/generated/examples/caching_ex-random_1.xml b/doc/generated/examples/caching_ex-random_1.xml index 19b02f5..18b04eb 100644 --- a/doc/generated/examples/caching_ex-random_1.xml +++ b/doc/generated/examples/caching_ex-random_1.xml @@ -2,8 +2,8 @@ % scons -Q cc -o f3.o -c f3.c cc -o f5.o -c f5.c -cc -o f2.o -c f2.c cc -o f4.o -c f4.c +cc -o f2.o -c f2.c cc -o f1.o -c f1.c cc -o prog f1.o f2.o f3.o f4.o f5.o diff --git a/doc/generated/examples/environments_ex3_1.xml b/doc/generated/examples/environments_ex3_1.xml index 12b6ae0..3262302 100644 --- a/doc/generated/examples/environments_ex3_1.xml +++ b/doc/generated/examples/environments_ex3_1.xml @@ -1,22 +1,6 @@ % scons -Q -UnicodeDecodeError: 'utf8' codec can't decode byte 0xc2 in position 547: invalid continuation byte: - File "/home/my/project/SConstruct", line 6: - dbg.Program('foo', 'foo.c') - File "bootstrap/src/engine/SCons/Environment.py", line 260: - return MethodWrapper.__call__(self, target, source, *args, **kw) - File "bootstrap/src/engine/SCons/Environment.py", line 224: - return self.method(*nargs, **kwargs) - File "bootstrap/src/engine/SCons/Builder.py", line 635: - return self._execute(env, target, source, OverrideWarner(kw), ekw) - File "bootstrap/src/engine/SCons/Builder.py", line 541: - source = self.src_builder_sources(env, source, overwarn) - File "bootstrap/src/engine/SCons/Builder.py", line 748: - tlist = bld._execute(env, None, [s], overwarn) - File "bootstrap/src/engine/SCons/Builder.py", line 557: - _node_errors(self, env, tlist, slist) - File "bootstrap/src/engine/SCons/Builder.py", line 303: - msg = "Two environments with different actions were specified for the same target: %s\n(action 1: %s)\n(action 2: %s)" % (t,t_contents.decode('utf-8'),contents.decode('utf-8')) - File "/home/bdbaddog/tools/python-2.7.13/lib/python2.7/encodings/utf_8.py", line 16: - return codecs.utf_8_decode(input, errors, True) + +scons: *** Two environments with different actions were specified for the same target: foo.o +File "/home/my/project/SConstruct", line 6, in <module> diff --git a/doc/generated/examples/java_jar1_1.xml b/doc/generated/examples/java_jar1_1.xml index daa3d1a..de93227 100644 --- a/doc/generated/examples/java_jar1_1.xml +++ b/doc/generated/examples/java_jar1_1.xml @@ -1,5 +1,5 @@ % scons -Q javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java -scons: *** [test.jar] Source `classes.class' not found, needed by target `test.jar'. +jar cf test.jar classes diff --git a/doc/generated/examples/troubleshoot_stacktrace_2.xml b/doc/generated/examples/troubleshoot_stacktrace_2.xml index 4b55f0d..52bfa43 100644 --- a/doc/generated/examples/troubleshoot_stacktrace_2.xml +++ b/doc/generated/examples/troubleshoot_stacktrace_2.xml @@ -4,7 +4,7 @@ scons: *** [prog.o] Source `prog.c' not found, needed by target `prog.o'. scons: internal stack trace: File "bootstrap/src/engine/SCons/Job.py", line 199, in start task.prepare() - File "bootstrap/src/engine/SCons/Script/Main.py", line 175, in prepare + File "bootstrap/src/engine/SCons/Script/Main.py", line 176, in prepare return SCons.Taskmaster.OutOfDateTask.prepare(self) File "bootstrap/src/engine/SCons/Taskmaster.py", line 198, in prepare executor.prepare() diff --git a/doc/generated/functions.gen b/doc/generated/functions.gen index 79a83c6..617a0a4 100644 --- a/doc/generated/functions.gen +++ b/doc/generated/functions.gen @@ -3523,16 +3523,16 @@ below, for a complete explanation of the arguments and behavior. - SConscript(scripts, [exports, variant_dir, duplicate]) + SConscript(scripts, [exports, variant_dir, duplicate, must_exist]) - env.SConscript(scripts, [exports, variant_dir, duplicate]) + env.SConscript(scripts, [exports, variant_dir, duplicate, must_exist]) - SConscript(dirs=subdirs, [name=script, exports, variant_dir, duplicate]) + SConscript(dirs=subdirs, [name=script, exports, variant_dir, duplicate, must_exist]) - env.SConscript(dirs=subdirs, [name=script, exports, variant_dir, duplicate]) + env.SConscript(dirs=subdirs, [name=script, exports, variant_dir, duplicate, must_exist]) @@ -3734,6 +3734,17 @@ TODO??? SConscript('build/SConscript', src_dir='src') +The optional +must_exist +argument, if true, causes an exception to be raised if a requested +SConscript file is not found. The current default is false, +causing only a warning to be omitted, but this behavior is deprecated. +For scripts which truly intend to be optional, transition to +explicty supplying +must_exist=False to the call. + + + Here are some composite examples: diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index a756d35..9246249 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -51,7 +51,9 @@ This is used to fill in the Architecture: field in an Ipkg control file, -and as part of the name of a generated RPM file. +and the BuildArch: field +in the RPM .spec file, +as well as forming part of the name of a generated RPM package file. @@ -240,7 +242,7 @@ or this: env = Environment() -env['BUILDERS]['NewBuilder'] = foo +env['BUILDERS']['NewBuilder'] = foo @@ -389,7 +391,6 @@ the control for Ipkg, the .wxs for MSI). If set, the function will be called after the SCons template for the file has been written. -XXX @@ -2943,15 +2944,6 @@ is -dNOPAUSE -dBATCH -sDEVICE=pdfwrite HOST_ARCH - The name of the host hardware architecture used to create the Environment. - If a platform is specified when creating the Environment, then - that Platform's logic will handle setting this value. - This value is immutable, and should not be changed by the user after - the Environment is initialized. - Currently only set for Win32. - - - Sets the host architecture for Visual Studio compiler. If not set, default to the detected host architecture: note that this may depend on the python you are using. @@ -2967,7 +2959,16 @@ Valid values are the same as for This is currently only used on Windows, but in the future it will be used on other OSes as well. - + + + The name of the host hardware architecture used to create the Environment. + If a platform is specified when creating the Environment, then + that Platform's logic will handle setting this value. + This value is immutable, and should not be changed by the user after + the Environment is initialized. + Currently only set for Win32. + + HOST_OS @@ -3209,7 +3210,7 @@ The command line used to call the Java archive tool. The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -3219,7 +3220,7 @@ env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET") The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -3933,10 +3934,10 @@ and these suffixes. LICENSE -The abbreviated name of the license under which -this project is released (gpl, lpgl, bsd etc.). +The abbreviated name, preferably the SPDX code, of the license under which +this project is released (GPL-3.0, LGPL-2.1, BSD-2-Clause etc.). See http://www.opensource.org/licenses/alphabetical -for a list of license names. +for a list of license names and SPDX codes. @@ -7100,13 +7101,6 @@ that may not be set or used in a construction environment. TARGET_ARCH - The name of the target hardware architecture for the compiled objects - created by this Environment. - This defaults to the value of HOST_ARCH, and the user can override it. - Currently only set for Win32. - - - Sets the target architecture for Visual Studio compiler (i.e. the arch of the binaries generated by the compiler). If not set, default to $HOST_ARCH, or, if that is unset, to the architecture of the @@ -7131,7 +7125,14 @@ and ia64 (Itanium). For example, if you want to compile 64-bit binaries, you would set TARGET_ARCH='x86_64' in your SCons environment. - + + + The name of the target hardware architecture for the compiled objects + created by this Environment. + This defaults to the value of HOST_ARCH, and the user can override it. + Currently only set for Win32. + + TARGET_OS @@ -7547,6 +7548,7 @@ This is used to fill in the BuildRequires: field in the RPM .spec file. +Note this should only be used on a host managed by rpm as the dependencies will not be resolvable at build time otherwise. @@ -7605,7 +7607,8 @@ field in the RPM This is used to fill in the Epoch: -field in the controlling information for RPM packages. +field in the RPM +.spec file. @@ -7631,6 +7634,38 @@ field in the RPM + + X_RPM_EXTRADEFS + + +A list used to supply extra defintions or flags +to be added to the RPM .spec file. +Each item is added as-is with a carriage return appended. +This is useful if some specific RPM feature not otherwise +anticipated by SCons needs to be turned on or off. +Note if this variable is omitted, SCons will by +default supply the value +'%global debug_package %{nil}' +to disable debug package generation. +To enable debug package generation, include this +variable set either to None, or to a custom +list that does not include the default line. +Added in version 3.1. + + + +env.Package( + NAME = 'foo', +... + X_RPM_EXTRADEFS = [ + '%define _unpackaged_files_terminate_build 0' + '%define _missing_doc_files_terminate_build 0' + ], +... ) + + + + X_RPM_GROUP diff --git a/doc/generated/variables.mod b/doc/generated/variables.mod index 6ecf6c9..52ee4e1 100644 --- a/doc/generated/variables.mod +++ b/doc/generated/variables.mod @@ -584,6 +584,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $X_RPM_EPOCH"> $X_RPM_EXCLUDEARCH"> $X_RPM_EXLUSIVEARCH"> +$X_RPM_EXTRADEFS"> $X_RPM_GROUP"> $X_RPM_GROUP_lang"> $X_RPM_ICON"> @@ -1213,6 +1214,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $X_RPM_EPOCH"> $X_RPM_EXCLUDEARCH"> $X_RPM_EXLUSIVEARCH"> +$X_RPM_EXTRADEFS"> $X_RPM_GROUP"> $X_RPM_GROUP_lang"> $X_RPM_ICON"> diff --git a/src/engine/SCons/Tool/packaging/__init__.xml b/src/engine/SCons/Tool/packaging/__init__.xml index 9b8eecf..41a3f11 100644 --- a/src/engine/SCons/Tool/packaging/__init__.xml +++ b/src/engine/SCons/Tool/packaging/__init__.xml @@ -477,7 +477,7 @@ field in the RPM A list used to supply extra defintions or flags -to be added to the RPM .spec file. +to be added to the RPM .spec file. Each item is added as-is with a carriage return appended. This is useful if some specific RPM feature not otherwise anticipated by SCons needs to be turned on or off. -- cgit v0.12 From 6bb0f67833cd198253dcf94342da7e792aaf9a55 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 26 Aug 2018 09:10:58 -0600 Subject: A few syntax cleanups Suggested by PyCharm. Includes three "real" changes: 1. src/engine/SCons/Node/__init__.py has a print statement in a function which references 'self', but there is no 'self' defined (it is not a method in a class). Guessing it should have been 'node'. 2. src/engine/SCons/Environment.py makes a call using 'kwbd' which is not defined, looks like a copy-paste error and should be 'bd'. 3. src/engine/SCons/Tool/JavaCommon.py splits 'file', which is not defined, was evidently supposed to be 'fn'. These should be double-checked. The rest are purely syntax: whitespace, dropping trailing semicolons, using "is" to test for None, simplifying comparisons, normalizing docstring commenting ("always triple double quotes"), unneeded backslashes. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 2 ++ src/engine/SCons/Action.py | 4 ++-- src/engine/SCons/Environment.py | 4 ++-- src/engine/SCons/Node/FS.py | 10 +++++----- src/engine/SCons/Node/__init__.py | 4 ++-- src/engine/SCons/Platform/posix.py | 2 +- src/engine/SCons/SConf.py | 2 +- src/engine/SCons/Scanner/Fortran.py | 2 +- src/engine/SCons/Scanner/LaTeX.py | 16 ++++++++-------- src/engine/SCons/Tool/GettextCommon.py | 6 +++--- src/engine/SCons/Tool/JavaCommon.py | 2 +- src/engine/SCons/Tool/__init__.py | 12 ++++++------ src/engine/SCons/Tool/intelc.py | 2 +- src/engine/SCons/Tool/jar.py | 2 +- src/engine/SCons/Tool/msvs.py | 10 +++++----- src/engine/SCons/Tool/packaging/__init__.py | 8 +++----- src/engine/SCons/Tool/packaging/msi.py | 5 ++--- src/engine/SCons/Tool/rpcgen.py | 2 +- src/engine/SCons/Tool/tex.py | 2 +- src/engine/SCons/Util.py | 10 +++++----- src/script/scons-time.py | 6 +++--- src/script/sconsign.py | 2 +- 22 files changed, 57 insertions(+), 58 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6bbff3e..6359560 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -152,6 +152,8 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Stop using deprecated unittest asserts - messages in strip-install-dir test now os-neutral - Add xz compression format to packaging choices. + - Syntax cleanups - trailing blanks, use "is" to compare with None, etc. + Three uses of variables not defined are changed. From Hao Wu - typo in customized decider example in user guide diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 9a3888b..78fb7d0 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -843,8 +843,8 @@ class CommandAction(_ActionAction): _ActionAction.__init__(self, **kw) if is_List(cmd): if [c for c in cmd if is_List(c)]: - raise TypeError("CommandAction should be given only " \ - "a single command") + raise TypeError("CommandAction should be given only " + "a single command") self.cmd_list = cmd def __str__(self): diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 42b28e6..81d0e5a 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -150,7 +150,7 @@ def _set_BUILDERS(env, key, value): for k in list(bd.keys()): del bd[k] except KeyError: - bd = BuilderDict(kwbd, env) + bd = BuilderDict(bd, env) env._dict[key] = bd for k, v in value.items(): if not SCons.Builder.is_a_Builder(v): @@ -2258,7 +2258,7 @@ class Base(SubstitutionEnvironment): while (node != node.srcnode()): node = node.srcnode() return node - sources = list(map( final_source, sources )); + sources = list(map(final_source, sources)) # remove duplicates return list(set(sources)) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 54cd423..bc15064 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -132,9 +132,9 @@ def initialize_do_splitdrive(): global do_splitdrive global has_unc drive, path = os.path.splitdrive('X:/foo') - # splitunc is removed from python 3.7 and newer + # splitunc is removed from python 3.7 and newer # so we can also just test if splitdrive works with UNC - has_unc = (hasattr(os.path, 'splitunc') + has_unc = (hasattr(os.path, 'splitunc') or os.path.splitdrive(r'\\split\drive\test')[0] == r'\\split\drive') do_splitdrive = not not drive or has_unc @@ -1397,10 +1397,10 @@ class FS(LocalFS): if not isinstance(d, SCons.Node.Node): d = self.Dir(d) self.Top.addRepository(d) - + def PyPackageDir(self, modulename): """Locate the directory of a given python module name - + For example scons might resolve to Windows: C:\Python27\Lib\site-packages\scons-2.5.1 Linux: /usr/lib/scons @@ -3305,7 +3305,7 @@ class File(Base): try: node = dir.entries[norm_name] except KeyError: node = dir.file_on_disk(self.name) if node and node.exists() and \ - (isinstance(node, File) or isinstance(node, Entry) \ + (isinstance(node, File) or isinstance(node, Entry) or not node.is_derived()): result = node # Copy over our local attributes to the repository diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index e186752..c18a954 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -155,7 +155,7 @@ def exists_file(node): # The source file does not exist. Make sure no old # copy remains in the variant directory. if print_duplicate: - print("dup: no src for %s, unlinking old variant copy"%self) + print("dup: no src for %s, unlinking old variant copy" % node) if exists_base(node) or node.islink(): node.fs.unlink(node.get_internal_path()) # Return None explicitly because the Base.exists() call @@ -665,7 +665,7 @@ class Node(object, with_metaclass(NoSlotsPyPy)): executor.cleanup() def reset_executor(self): - "Remove cached executor; forces recompute when needed." + """Remove cached executor; forces recompute when needed.""" try: delattr(self, 'executor') except AttributeError: diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py index 8db08db..ae2ad1a 100644 --- a/src/engine/SCons/Platform/posix.py +++ b/src/engine/SCons/Platform/posix.py @@ -48,7 +48,7 @@ exitvalmap = { } def escape(arg): - "escape shell special characters" + """escape shell special characters""" slash = '\\' special = '"$' diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index a14127e..0dcbab8 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -1000,7 +1000,7 @@ def CheckLib(context, library = None, symbol = "main", compiles without flags. """ - if library == []: + if not library: library = [None] if not SCons.Util.is_List(library): diff --git a/src/engine/SCons/Scanner/Fortran.py b/src/engine/SCons/Scanner/Fortran.py index 1b55130..6065bbd 100644 --- a/src/engine/SCons/Scanner/Fortran.py +++ b/src/engine/SCons/Scanner/Fortran.py @@ -78,7 +78,7 @@ class F90Scanner(SCons.Scanner.Classic): def scan(self, node, env, path=()): # cache the includes list in node so we only scan it once: - if node.includes != None: + if node.includes is not None: mods_and_includes = node.includes else: # retrieve all included filenames diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py index 5800443..1cf2567 100644 --- a/src/engine/SCons/Scanner/LaTeX.py +++ b/src/engine/SCons/Scanner/LaTeX.py @@ -128,8 +128,8 @@ class LaTeX(SCons.Scanner.Base): Unlike most scanners, which use regular expressions that just return the included file name, this returns a tuple consisting of the keyword for the inclusion ("include", "includegraphics", - "input", or "bibliography"), and then the file name itself. - Based on a quick look at LaTeX documentation, it seems that we + "input", or "bibliography"), and then the file name itself. + Based on a quick look at LaTeX documentation, it seems that we should append .tex suffix for the "include" keywords, append .tex if there is no extension for the "input" keyword, and need to add .bib for the "bibliography" keyword that does not accept extensions by itself. @@ -137,7 +137,7 @@ class LaTeX(SCons.Scanner.Base): Finally, if there is no extension for an "includegraphics" keyword latex will append .ps or .eps to find the file, while pdftex may use .pdf, .jpg, .tif, .mps, or .png. - + The actual subset and search order may be altered by DeclareGraphicsExtensions command. This complication is ignored. The default order corresponds to experimentation with teTeX:: @@ -333,7 +333,7 @@ class LaTeX(SCons.Scanner.Base): line_continues_a_comment = False for line in text.splitlines(): line,comment = self.comment_re.findall(line)[0] - if line_continues_a_comment == True: + if line_continues_a_comment: out[-1] = out[-1] + line.lstrip() else: out.append(line) @@ -349,7 +349,7 @@ class LaTeX(SCons.Scanner.Base): # path_dict = dict(list(path)) # add option for whitespace (\s) before the '[' noopt_cre = re.compile('\s*\[.*$') - if node.includes != None: + if node.includes is not None: includes = node.includes else: text = self.canonical_text(node.get_text_contents()) @@ -386,8 +386,8 @@ class LaTeX(SCons.Scanner.Base): directory of the main file just as latex does""" path_dict = dict(list(path)) - - queue = [] + + queue = [] queue.extend( self.scan(node) ) seen = {} @@ -402,7 +402,7 @@ class LaTeX(SCons.Scanner.Base): source_dir = node.get_dir() #for include in includes: while queue: - + include = queue.pop() inc_type, inc_subdir, inc_filename = include diff --git a/src/engine/SCons/Tool/GettextCommon.py b/src/engine/SCons/Tool/GettextCommon.py index 2d37def..b7d02a7 100644 --- a/src/engine/SCons/Tool/GettextCommon.py +++ b/src/engine/SCons/Tool/GettextCommon.py @@ -390,7 +390,7 @@ def _detect_xgettext(env): """ Detects *xgettext(1)* binary """ if 'XGETTEXT' in env: return env['XGETTEXT'] - xgettext = env.Detect('xgettext'); + xgettext = env.Detect('xgettext') if xgettext: return xgettext raise SCons.Errors.StopError(XgettextNotFound, "Could not detect xgettext") @@ -409,7 +409,7 @@ def _detect_msginit(env): """ Detects *msginit(1)* program. """ if 'MSGINIT' in env: return env['MSGINIT'] - msginit = env.Detect('msginit'); + msginit = env.Detect('msginit') if msginit: return msginit raise SCons.Errors.StopError(MsginitNotFound, "Could not detect msginit") @@ -428,7 +428,7 @@ def _detect_msgmerge(env): """ Detects *msgmerge(1)* program. """ if 'MSGMERGE' in env: return env['MSGMERGE'] - msgmerge = env.Detect('msgmerge'); + msgmerge = env.Detect('msgmerge') if msgmerge: return msgmerge raise SCons.Errors.StopError(MsgmergeNotFound, "Could not detect msgmerge") diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index e90e768..23cc43b 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -389,7 +389,7 @@ else: is that the file name matches the public class name, and that the path to the file is the same as the package name. """ - return os.path.split(file) + return os.path.split(fn) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index 0b340c0..8a94a71 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -238,7 +238,7 @@ class Tool(object): setattr(SCons.Tool, self.name, module) found_module = module - + if found_module is not None: sys.path = oldpythonpath return found_module @@ -1081,11 +1081,11 @@ class ToolInitializer(object): env.Tool(tool) return - # If we fall through here, there was no tool module found. - # This is where we can put an informative error message - # about the inability to find the tool. We'll start doing - # this as we cut over more pre-defined Builder+Tools to use - # the ToolInitializer class. + # If we fall through here, there was no tool module found. + # This is where we can put an informative error message + # about the inability to find the tool. We'll start doing + # this as we cut over more pre-defined Builder+Tools to use + # the ToolInitializer class. def Initializers(env): ToolInitializer(env, ['install'], ['_InternalInstall', '_InternalInstallAs', '_InternalInstallVersionedLib']) diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py index 02da912..9fc0bf7 100644 --- a/src/engine/SCons/Tool/intelc.py +++ b/src/engine/SCons/Tool/intelc.py @@ -73,7 +73,7 @@ def linux_ver_normalize(vstr): m = re.match(r'([0-9]+)\.([0-9]+)\.([0-9]+)', vstr) if m: vmaj,vmin,build = m.groups() - return float(vmaj) * 10. + float(vmin) + float(build) / 1000.; + return float(vmaj) * 10. + float(vmin) + float(build) / 1000. else: f = float(vstr) if is_windows: diff --git a/src/engine/SCons/Tool/jar.py b/src/engine/SCons/Tool/jar.py index 6e319c1..481f8f5 100644 --- a/src/engine/SCons/Tool/jar.py +++ b/src/engine/SCons/Tool/jar.py @@ -115,7 +115,7 @@ def Jar(env, target = None, source = [], *args, **kw): return jars # they passed no target so make a target implicitly - if target == None: + if target is None: try: # make target from the first source file target = os.path.splitext(str(source[0]))[0] + env.subst('$JARSUFFIX') diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index e1175e0..62f27f2 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -149,9 +149,9 @@ def splitFully(path): return [base] def makeHierarchy(sources): - '''Break a list of files into a hierarchy; for each value, if it is a string, + """Break a list of files into a hierarchy; for each value, if it is a string, then it is a file. If it is a dictionary, it is a folder. The string is - the original path of the file.''' + the original path of the file.""" hierarchy = {} for file in sources: @@ -189,7 +189,7 @@ class _UserGenerator(object): elif SCons.Util.is_List(env['variant']): variants = env['variant'] - if 'DebugSettings' not in env or env['DebugSettings'] == None: + if 'DebugSettings' not in env or env['DebugSettings'] is None: dbg_settings = [] elif SCons.Util.is_Dict(env['DebugSettings']): dbg_settings = [env['DebugSettings']] @@ -1287,7 +1287,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User): 'Other Files': ''} cats = sorted([k for k in list(categories.keys()) if self.sources[k]], - key = lambda a: a.lower()) + key = lambda a: a.lower()) # print vcxproj.filters file first self.filters_file.write('\t\n') @@ -1519,7 +1519,7 @@ class _GenerateV7DSW(_DSWGenerator): name = base self.file.write('Project("%s") = "%s", "%s", "%s"\n' % (external_makefile_guid, name, dspinfo['SLN_RELATIVE_FILE_PATH'], dspinfo['GUID'])) - if self.version_num >= 7.1 and self.version_num < 8.0: + if 7.1 <= self.version_num < 8.0: self.file.write('\tProjectSection(ProjectDependencies) = postProject\n' '\tEndProjectSection\n') self.file.write('EndProject\n') diff --git a/src/engine/SCons/Tool/packaging/__init__.py b/src/engine/SCons/Tool/packaging/__init__.py index 2e98b07..d4e5f3d 100644 --- a/src/engine/SCons/Tool/packaging/__init__.py +++ b/src/engine/SCons/Tool/packaging/__init__.py @@ -107,7 +107,7 @@ def Package(env, target=None, source=None, **kw): from SCons.Script import GetOption kw['PACKAGETYPE'] = GetOption('package_type') - if kw['PACKAGETYPE'] == None: + if kw['PACKAGETYPE'] is None: if 'Tar' in env['BUILDERS']: kw['PACKAGETYPE']='targz' elif 'Zip' in env['BUILDERS']: @@ -295,10 +295,8 @@ def stripinstallbuilder(target, source, env): It also warns about files which have no install builder attached. """ def has_no_install_location(file): - return not (file.has_builder() and\ - hasattr(file.builder, 'name') and\ - (file.builder.name=="InstallBuilder" or\ - file.builder.name=="InstallAsBuilder")) + return not file.has_builder() and hasattr(file.builder, 'name') \ + and file.builder.name in ["InstallBuilder", "InstallAsBuilder"] if len([src for src in source if has_no_install_location(src)]): warn(Warning, "there are files to package which have no\ diff --git a/src/engine/SCons/Tool/packaging/msi.py b/src/engine/SCons/Tool/packaging/msi.py index c25f856..7e28df3 100644 --- a/src/engine/SCons/Tool/packaging/msi.py +++ b/src/engine/SCons/Tool/packaging/msi.py @@ -114,8 +114,7 @@ def gen_dos_short_file_name(file, filename_set): # thisis1.txt, thisis2.txt etc. duplicate, num = not None, 1 while duplicate: - shortname = "%s%s" % (fname[:8-len(str(num))].upper(),\ - str(num)) + shortname = "%s%s" % (fname[:8-len(str(num))].upper(), str(num)) if len(ext) >= 2: shortname = "%s%s" % (shortname, ext[:4].upper()) @@ -301,7 +300,7 @@ def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set, if c.nodeName == 'Directory' and c.attributes['LongName'].value == escape(d)] - if already_created != []: + if already_created: Directory = already_created[0] dir_parts.remove(d) upper_dir += d diff --git a/src/engine/SCons/Tool/rpcgen.py b/src/engine/SCons/Tool/rpcgen.py index 4af5965..5ed5658 100644 --- a/src/engine/SCons/Tool/rpcgen.py +++ b/src/engine/SCons/Tool/rpcgen.py @@ -43,7 +43,7 @@ rpcgen_service = cmd % ('m', '$RPCGENSERVICEFLAGS') rpcgen_xdr = cmd % ('c', '$RPCGENXDRFLAGS') def generate(env): - "Add RPCGEN Builders and construction variables for an Environment." + """Add RPCGEN Builders and construction variables for an Environment.""" client = Builder(action=rpcgen_client, suffix='_clnt.c', src_suffix='.x') header = Builder(action=rpcgen_header, suffix='.h', src_suffix='.x') diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 8e09d56..2dfa229 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -790,7 +790,7 @@ def tex_emitter_core(target, source, env, graphics_extensions): for multibibmatch in multibib_re.finditer(content): if Verbose: print("multibib match ",multibibmatch.group(1)) - if multibibmatch != None: + if multibibmatch is not None: baselist = multibibmatch.group(1).split(',') if Verbose: print("multibib list ", baselist) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index f691cd9..424c694 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -103,7 +103,7 @@ def containsOnly(str, set): return 1 def splitext(path): - "Same as os.path.splitext() but faster." + """Same as os.path.splitext() but faster.""" sep = rightmost_separator(path, os.sep) dot = path.rfind('.') # An ext is only real if it has at least one non-digit char @@ -1370,8 +1370,8 @@ def make_path_relative(path): # The original idea for AddMethod() and RenameFunction() come from the # following post to the ActiveState Python Cookbook: # -# ASPN: Python Cookbook : Install bound methods in an instance -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223613 +# ASPN: Python Cookbook : Install bound methods in an instance +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223613 # # That code was a little fragile, though, so the following changes # have been wrung on it: @@ -1388,8 +1388,8 @@ def make_path_relative(path): # the "new" module, as alluded to in Alex Martelli's response to the # following Cookbook post: # -# ASPN: Python Cookbook : Dynamically added methods to a class -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81732 +# ASPN: Python Cookbook : Dynamically added methods to a class +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81732 def AddMethod(obj, function, name=None): """ diff --git a/src/script/scons-time.py b/src/script/scons-time.py index aa875f1..d114f9a 100644 --- a/src/script/scons-time.py +++ b/src/script/scons-time.py @@ -58,12 +58,12 @@ def make_temp_file(**kw): return result def HACK_for_exec(cmd, *args): - ''' + """ For some reason, Python won't allow an exec() within a function that also declares an internal function (including lambda functions). This function is a hack that calls exec() in a function with no internal functions. - ''' + """ if not args: exec(cmd) elif len(args) == 1: exec(cmd, args[0]) else: exec(cmd, args[0], args[1]) @@ -147,7 +147,7 @@ class Gnuplotter(Plotter): return line.plot_string() def vertical_bar(self, x, type, label, comment): - if self.get_min_x() <= x and x <= self.get_max_x(): + if self.get_min_x() <= x <= self.get_max_x(): points = [(x, 0), (x, self.max_graph_value(self.get_max_y()))] self.line(points, type, label, comment) diff --git a/src/script/sconsign.py b/src/script/sconsign.py index e7bc271..559dffe 100644 --- a/src/script/sconsign.py +++ b/src/script/sconsign.py @@ -275,7 +275,7 @@ def map_bkids(entry, name): result = [] for i in range(len(bkids)): result.append(nodeinfo_string(bkids[i], bkidsigs[i], " ")) - if result == []: + if not result: return None return "\n ".join(result) -- cgit v0.12 From 2470a8e579846495d57d72712e6642e20578fd36 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 4 Oct 2018 10:37:44 -0600 Subject: Bugfix on packaging init syntax change Signed-off-by: Mats Wichmann --- src/engine/SCons/Tool/packaging/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Tool/packaging/__init__.py b/src/engine/SCons/Tool/packaging/__init__.py index d4e5f3d..6261f98 100644 --- a/src/engine/SCons/Tool/packaging/__init__.py +++ b/src/engine/SCons/Tool/packaging/__init__.py @@ -295,8 +295,9 @@ def stripinstallbuilder(target, source, env): It also warns about files which have no install builder attached. """ def has_no_install_location(file): - return not file.has_builder() and hasattr(file.builder, 'name') \ - and file.builder.name in ["InstallBuilder", "InstallAsBuilder"] + return not (file.has_builder() and hasattr(file.builder, 'name') + and file.builder.name in ["InstallBuilder", "InstallAsBuilder"]) + if len([src for src in source if has_no_install_location(src)]): warn(Warning, "there are files to package which have no\ -- cgit v0.12 From f03ff1b92efbffd410d744869a3b5327f5d211be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Fri, 5 Oct 2018 14:35:17 +0200 Subject: add test cases to exhibit bugs in must_[not_]contain() --- testing/framework/TestCommonTests.py | 56 ++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/testing/framework/TestCommonTests.py b/testing/framework/TestCommonTests.py index 7949cb8..c54f33f 100644 --- a/testing/framework/TestCommonTests.py +++ b/testing/framework/TestCommonTests.py @@ -306,6 +306,23 @@ class must_contain_TestCase(TestCommonTestCase): stderr = run_env.stderr() assert stderr == "PASSED\n", stderr + def test_success_index_0(self): + """Test must_contain(): success at index 0""" + run_env = self.run_env + + script = lstrip("""\ + from TestCommon import TestCommon + tc = TestCommon(workdir='') + tc.write('file1', "file1 contents\\n") + tc.must_contain('file1', "file1 c") + tc.pass_test() + """) + run_env.run(program=sys.executable, stdin=script) + stdout = run_env.stdout() + assert stdout == "", stdout + stderr = run_env.stderr() + assert stderr == "PASSED\n", stderr + def test_file_missing(self): """Test must_contain(): file missing""" run_env = self.run_env @@ -1145,6 +1162,9 @@ class must_match_TestCase(TestCommonTestCase): """) expect = lstrip("""\ + match_re: mismatch at line 0: + search re='^file1$' + line='file1 does not match' Unexpected contents of `file1' contents ======================================================================= 1c1 @@ -1324,6 +1344,31 @@ class must_not_contain_TestCase(TestCommonTestCase): stderr = run_env.stderr() assert stderr.find("FAILED") != -1, stderr + def test_failure_index_0(self): + """Test must_not_contain(): failure at index 0""" + run_env = self.run_env + + script = lstrip("""\ + from TestCommon import TestCommon + tc = TestCommon(workdir='') + tc.write('file1', "file1 does contain contents\\n") + tc.must_not_contain('file1', "file1 does") + tc.run() + """) + expect = lstrip("""\ + File `file1' contains banned string. + Banned string ================================================================== + file1 does + file1 contents ================================================================= + file1 does contain contents + + """) + run_env.run(program=sys.executable, stdin=script) + stdout = run_env.stdout() + assert stdout == expect, repr(stdout) + stderr = run_env.stderr() + assert stderr.find("FAILED") != -1, stderr + def test_mode(self): """Test must_not_contain(): mode""" run_env = self.run_env @@ -1812,6 +1857,7 @@ class run_TestCase(TestCommonTestCase): """) expect_stdout = lstrip("""\ + match_re: expected 1 lines, found 2 STDOUT ========================================================================= STDERR ========================================================================= @@ -2024,6 +2070,9 @@ class run_TestCase(TestCommonTestCase): """) expect_stdout = lstrip("""\ + match_re: mismatch at line 0: + search re='^Not found$' + line='%(pass_script)s: STDOUT: []' STDOUT ========================================================================= 1c1 < Not found @@ -2053,6 +2102,9 @@ class run_TestCase(TestCommonTestCase): """) expect_stdout = lstrip("""\ + match_re: mismatch at line 0: + search re='^Not found$' + line='%(stderr_script)s: STDERR: []' STDOUT ========================================================================= STDERR ========================================================================= @@ -2286,14 +2338,14 @@ class variables_TestCase(TestCommonTestCase): 'dll_suffix', ] - script = "from __future__ import print_function" + \ + script = "from __future__ import print_function\n" + \ "import TestCommon\n" + \ '\n'.join([ "print(TestCommon.%s)\n" % v for v in variables ]) run_env.run(program=sys.executable, stdin=script) stderr = run_env.stderr() assert stderr == "", stderr - script = "from __future__ import print_function" + \ + script = "from __future__ import print_function\n" + \ "from TestCommon import *\n" + \ '\n'.join([ "print(%s)" % v for v in variables ]) run_env.run(program=sys.executable, stdin=script) -- cgit v0.12 From 0846483714b5f94bd8f346333479a32b39c90e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Fri, 5 Oct 2018 14:35:41 +0200 Subject: fixed bugs in must_[not_]_contain() --- src/CHANGES.txt | 3 +++ testing/framework/TestCommon.py | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6359560..72ba123 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Paweł Tomulik: + - Fixed must_contain() and must_not_contain() to work with substrings + located at zero offset in a file. From Daniel Moody: - Updated FS.py to handle removal of splitunc function from python 3.7 diff --git a/testing/framework/TestCommon.py b/testing/framework/TestCommon.py index e55b491..53c0388 100644 --- a/testing/framework/TestCommon.py +++ b/testing/framework/TestCommon.py @@ -292,14 +292,13 @@ class TestCommon(TestCmd): return o.index(l) except ValueError: return None - contains = find(file_contents, required) - if not contains: + if find(file_contents, required) is None: print("File `%s' does not contain required string." % file) print(self.banner('Required string ')) print(required) print(self.banner('%s contents ' % file)) print(file_contents) - self.fail_test(not contains) + self.fail_test() def must_contain_all(self, output, input, title=None, find=None): """Ensures that the specified output string (first argument) @@ -514,14 +513,14 @@ class TestCommon(TestCmd): return o.index(l) except ValueError: return None - contains = find(file_contents, banned) - if contains: + + if find(file_contents, banned) is not None: print("File `%s' contains banned string." % file) print(self.banner('Banned string ')) print(banned) print(self.banner('%s contents ' % file)) print(file_contents) - self.fail_test(contains) + self.fail_test() def must_not_contain_any_line(self, output, lines, title=None, find=None): """Ensures that the specified output string (first argument) -- cgit v0.12 From ec2f065ab7ab954c08ab6cae2d1e8b0a210be401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Fri, 5 Oct 2018 16:16:06 +0200 Subject: make the must[_not]_contain_...() functions compatible with str.find --- testing/framework/TestCommon.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/testing/framework/TestCommon.py b/testing/framework/TestCommon.py index 53c0388..6352214 100644 --- a/testing/framework/TestCommon.py +++ b/testing/framework/TestCommon.py @@ -275,8 +275,8 @@ class TestCommon(TestCmd): reading the file; current implementation will convert. mode (string): file open mode. find (func): optional custom search routine. Must take the - form "find(output, line)" returning non-zero on success - and None on failure. + form "find(output, line)" non-negative integer on success + and None, or -1, on failure. Calling test exits FAILED if search result is false """ @@ -292,7 +292,7 @@ class TestCommon(TestCmd): return o.index(l) except ValueError: return None - if find(file_contents, required) is None: + if find(file_contents, required) in (None,-1): print("File `%s' does not contain required string." % file) print(self.banner('Required string ')) print(required) @@ -321,7 +321,7 @@ class TestCommon(TestCmd): if is_List(output): output = os.newline.join(output) - if find(output, input) is None: + if find(output, input) in (None, -1): if title is None: title = 'output' print('Missing expected input from {}:'.format(title)) @@ -352,7 +352,7 @@ class TestCommon(TestCmd): output = '\n'.join(output) for line in lines: - if find(output, line) is None: + if find(output, line) in (None, -1): missing.append(line) if missing: @@ -383,7 +383,7 @@ class TestCommon(TestCmd): except ValueError: return None for line in lines: - if find(output, line) is not None: + if find(output, line) not in (None, -1): return if title is None: @@ -425,7 +425,7 @@ class TestCommon(TestCmd): missing = [] for line in exp: found = find(out, line) - if found is None: + if found in (None, -1): missing.append(line) else: out.pop(found) @@ -514,7 +514,7 @@ class TestCommon(TestCmd): except ValueError: return None - if find(file_contents, banned) is not None: + if find(file_contents, banned) not in (None, -1): print("File `%s' contains banned string." % file) print(self.banner('Banned string ')) print(banned) @@ -541,7 +541,7 @@ class TestCommon(TestCmd): return None unexpected = [] for line in lines: - if find(output, line) is not None: + if find(output, line) not in (None, -1): unexpected.append(line) if unexpected: -- cgit v0.12 From 0afde1f83a5682dc46493aa341ff0a813492839e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Fri, 5 Oct 2018 18:16:36 +0200 Subject: fixed some docs in TestCommon.py and refactored a little --- testing/framework/TestCommon.py | 98 ++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 59 deletions(-) diff --git a/testing/framework/TestCommon.py b/testing/framework/TestCommon.py index 6352214..60e0abd 100644 --- a/testing/framework/TestCommon.py +++ b/testing/framework/TestCommon.py @@ -206,6 +206,28 @@ def separate_files(flist): missing.append(f) return existing, missing +def contains(seq, subseq, find): + # Returns True or False. + if find is None: + return subseq in seq + else: + f = find(seq, subseq) + return f not in (None, -1) and f is not False + +def find_index(seq, subseq, find): + # Returns either an index of the subseq within the seq, or None. + # Accepts a function find(seq, subseq), which returns an integer on success + # and either: None, False, or -1, on failure. + if find is None: + try: + return seq.index(subseq) + except ValueError: + return None + else: + i = find(seq, subseq) + return None if (i in (None, -1) or i is False) else i + + if os.name == 'posix': def _failed(self, status = 0): if self.status is None or status is None: @@ -276,7 +298,7 @@ class TestCommon(TestCmd): mode (string): file open mode. find (func): optional custom search routine. Must take the form "find(output, line)" non-negative integer on success - and None, or -1, on failure. + and None, False, or -1, on failure. Calling test exits FAILED if search result is false """ @@ -286,13 +308,8 @@ class TestCommon(TestCmd): # (str) type in that, so convert. required = to_bytes(required) file_contents = self.read(file, mode) - if find is None: - def find(o, l): - try: - return o.index(l) - except ValueError: - return None - if find(file_contents, required) in (None,-1): + + if not contains(file_contents, required, find): print("File `%s' does not contain required string." % file) print(self.banner('Required string ')) print(required) @@ -308,20 +325,13 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(line, output), to use when searching + function, of the form "find(output, line), to use when searching for lines in the output. """ - if find is None: - def find(o, i): - try: - return o.index(i) - except ValueError: - return None - if is_List(output): output = os.newline.join(output) - if find(output, input) in (None, -1): + if not contains(output, input, find): if title is None: title = 'output' print('Missing expected input from {}:'.format(title)) @@ -338,21 +348,15 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(line, output), to use when searching + function, of the form "find(output, line), to use when searching for lines in the output. """ - if find is None: - def find(o, l): - try: - return o.index(l) - except ValueError: - return None missing = [] if is_List(output): output = '\n'.join(output) for line in lines: - if find(output, line) in (None, -1): + if not contains(output, line, find): missing.append(line) if missing: @@ -373,17 +377,11 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(line, output), to use when searching + function, of the form "find(output, line), to use when searching for lines in the output. """ - if find is None: - def find(o, l): - try: - return o.index(l) - except ValueError: - return None for line in lines: - if find(output, line) not in (None, -1): + if contains(output, line, find): return if title is None: @@ -404,7 +402,7 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(line, output), to use when searching + function, of the form "find(output, line), to use when searching for lines in the output. The function must return the index of the found line in the output, or None if the line is not found. """ @@ -416,19 +414,13 @@ class TestCommon(TestCmd): if sorted(out) == sorted(exp): # early out for exact match return - if find is None: - def find(o, l): - try: - return o.index(l) - except ValueError: - return None missing = [] for line in exp: - found = find(out, line) - if found in (None, -1): + i = find_index(out, line, find) + if i is None: missing.append(line) else: - out.pop(found) + out.pop(i) if not missing and not out: # all lines were matched @@ -507,14 +499,8 @@ class TestCommon(TestCmd): """Ensures that the specified file doesn't contain the banned text. """ file_contents = self.read(file, mode) - if find is None: - def find(o, l): - try: - return o.index(l) - except ValueError: - return None - - if find(file_contents, banned) not in (None, -1): + + if contains(file_contents, banned, find): print("File `%s' contains banned string." % file) print(self.banner('Banned string ')) print(banned) @@ -530,18 +516,12 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(line, output), to use when searching + function, of the form "find(output, line), to use when searching for lines in the output. """ - if find is None: - def find(o, l): - try: - return o.index(l) - except ValueError: - return None unexpected = [] for line in lines: - if find(output, line) not in (None, -1): + if contains(output, line, find): unexpected.append(line) if unexpected: -- cgit v0.12 From 488e42055a96491962e052f255acca7835fe2735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Fri, 5 Oct 2018 21:48:37 +0200 Subject: update src/CHANGES.txt --- src/CHANGES.txt | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 72ba123..4fefe98 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,22 +6,18 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - From Paweł Tomulik: - - Fixed must_contain() and must_not_contain() to work with substrings - located at zero offset in a file. - From Daniel Moody: - Updated FS.py to handle removal of splitunc function from python 3.7 - Updated the vc.py to ignore MSVS versions where not compiler could be found From Matthew Marinets: - - Fixed an issue that caused the Java emitter to incorrectly parse arguments to constructors that + - Fixed an issue that caused the Java emitter to incorrectly parse arguments to constructors that implemented a class. From Bernard Blackham: - Fixed handling of side-effects in task master (fixes #3013). - + From Ray Donnelly: - Fix the PATH created by scons.bat (and other .bat files) to provide a normalized PATH. Some pythons in the 3.6 series are no longer able to handle paths which @@ -38,7 +34,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Fix issue # 3106 MSVC if using MSVC_BATCH and target dir had a space would fail due to quirk in MSVC's handling of escaped targetdirs when batch compiling. - Re-Enable parallel SCons (-j) when running via Pypy - - Move SCons test framework files to testing/framework and remove all references to QMtest. + - Move SCons test framework files to testing/framework and remove all references to QMtest. QMTest has not been used by SCons for some time now. - Updated logic for mingw and clang on win32 to search default tool install paths if not found in normal SCons PATH. If the user specifies PATH or tool specific paths they @@ -77,7 +73,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Updated gettext tools to setup default paths for windows with Cygwin/MinGW setups - Add common location for default paths for cygwin and mingw in Platform modules - Updated YACC tool to work on windows with Cygwin/MinGW setups - - Set the pickling protocal back to highest which was causing issues + - Set the pickling protocal back to highest which was causing issues with variant dir tests. This will cause issues if reading sconsigns pickled with the previous lower protocal. @@ -99,6 +95,10 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE Specifically, this fixes the test cases use by Configure.CheckCC() which would fail when using -Wstrict-prototypes. + From Paweł Tomulik: + - Fixed must_contain(), must_not_contain(), etc. to work with substrings + located at zero offset. + From Richard West: - Add SConstruct.py, Sconstruct.py, sconstruct.py to the search path for the root SConstruct file. Allows easier debugging within Visual Studio @@ -127,11 +127,11 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Quiet py3 warning in UtilTests.py - Fix tests specifying octal constants for py3 - Fix must_contain tests for py3 - - RPM package generation: + - RPM package generation: - Fix supplying a build architecture - Disable auto debug package generation on certain rpmbuild versions - Adjust some tests to only supply build-id file on certain rpmbuild versions - - Tests now use a file fixture for the repeated (trivial) main.c program. + - Tests now use a file fixture for the repeated (trivial) main.c program. - Document and comment cleanup. - Added new Environment Value X_RPM_EXTRADEFS to supply custom settings to the specfile without adding specific logic for each one to scons. @@ -157,9 +157,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Add xz compression format to packaging choices. - Syntax cleanups - trailing blanks, use "is" to compare with None, etc. Three uses of variables not defined are changed. - + From Hao Wu - - typo in customized decider example in user guide + - typo in customized decider example in user guide From Hao Wu - Replace usage of unittest.TestSuite with unittest.main() (fix #3113) @@ -173,24 +173,24 @@ RELEASE 3.0.1 - Mon, 12 Nov 2017 15:31:33 -0700 - Jar can take multiple targets, and will make a duplicate jar from the sources for each target - Added some warnings in case the Jar builder makes an implicit target - Added Jar method and changed jar build to be more specific. Jar method will take in - directories or classes as source. Added more tests to JAR to ensure the jar was + directories or classes as source. Added more tests to JAR to ensure the jar was packaged with the correct compiled class files. - - Added a No result test case to handle bug which seems unrelated to java in the + - Added a No result test case to handle bug which seems unrelated to java in the swig-dependencies.py test, more info here: http://scons.tigris.org/issues/show_bug.cgi?id=2907 - Added a travis script to test on ubuntu trusty now that the project is on github - so that Continuus Integration tests can be run automatically. It tests most case and considers - no result a pass as well. Improving this script can install more dependincies allowing for more + so that Continuus Integration tests can be run automatically. It tests most case and considers + no result a pass as well. Improving this script can install more dependincies allowing for more tests to be run. - + From Daniel Moody: - Updated the Jar Builder tool in Tool/__init__.py so that is doesn't force class files as sources, allowing directories to be passed, which was causing test/Java/JAR.py to fail. From William Deegan: - Fix issue where code in utility routine to_String_for_subst() had code whose result was never - properly returned. + properly returned. (Found by: James Rinkevich https://pairlist4.pair.net/pipermail/scons-users/2017-October/006358.html ) - - Fixed Variables.GenerateHelpText() to now use the sort parameter. Due to incorrect 2to3 fixer changes + - Fixed Variables.GenerateHelpText() to now use the sort parameter. Due to incorrect 2to3 fixer changes 8 years ago it was being used as a boolean parameter. Now you can specify sort to be a callable, or boolean value. (True = normal sort). Manpage also updated. - Fixed Tool loading logic from exploding sys.path with many site_scons/site_tools prepended on py3. @@ -209,7 +209,7 @@ RELEASE 3.0.1 - Mon, 12 Nov 2017 15:31:33 -0700 From Zachary Tessler: - Fix incorrect warning for repeated identical builder calls that use overrides - + RELEASE 3.0.0 - Mon, 18 Sep 2017 08:32:04 -0700 NOTE: This is a major release. You should expect that some targets may rebuild when upgrading. @@ -282,9 +282,9 @@ will cause rebuilds. - Add support for Visual Studio 2017. This support requires vswhere.exe a helper tool installed with newer installs of 2017. SCons expects it to be located at "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" - It can be downloaded separately at + It can be downloaded separately at https://github.com/Microsoft/vswhere - + From Tom Tanner: - Allow nested $( ... $) sections -- cgit v0.12 From 8c8deec7bee7fd90cc4006d583e5f4e5ad9f3ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Fri, 5 Oct 2018 22:07:56 +0200 Subject: fixed minor typos --- testing/framework/.TestCommonTests.py.swp | Bin 0 -> 16384 bytes testing/framework/TestCommon.py | 10 +++++----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 testing/framework/.TestCommonTests.py.swp diff --git a/testing/framework/.TestCommonTests.py.swp b/testing/framework/.TestCommonTests.py.swp new file mode 100644 index 0000000..fcee08e Binary files /dev/null and b/testing/framework/.TestCommonTests.py.swp differ diff --git a/testing/framework/TestCommon.py b/testing/framework/TestCommon.py index 60e0abd..6b4b0bd 100644 --- a/testing/framework/TestCommon.py +++ b/testing/framework/TestCommon.py @@ -325,7 +325,7 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(output, line), to use when searching + function, of the form "find(output, line)", to use when searching for lines in the output. """ if is_List(output): @@ -348,7 +348,7 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(output, line), to use when searching + function, of the form "find(output, line)", to use when searching for lines in the output. """ missing = [] @@ -377,7 +377,7 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(output, line), to use when searching + function, of the form "find(output, line)", to use when searching for lines in the output. """ for line in lines: @@ -402,7 +402,7 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(output, line), to use when searching + function, of the form "find(output, line)", to use when searching for lines in the output. The function must return the index of the found line in the output, or None if the line is not found. """ @@ -516,7 +516,7 @@ class TestCommon(TestCmd): of output being searched, and only shows up in failure output. An optional fourth argument can be used to supply a different - function, of the form "find(output, line), to use when searching + function, of the form "find(output, line)", to use when searching for lines in the output. """ unexpected = [] -- cgit v0.12 From 01203bc7ac4f71fe0b76da0248f7139539b2d3ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Mon, 8 Oct 2018 12:19:34 +0200 Subject: minor adjustment to src/CHANGES.txt --- src/CHANGES.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4fefe98..c8ec110 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Daniel Moody: - Updated FS.py to handle removal of splitunc function from python 3.7 - Updated the vc.py to ignore MSVS versions where not compiler could be found @@ -17,7 +18,6 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From Bernard Blackham: - Fixed handling of side-effects in task master (fixes #3013). - From Ray Donnelly: - Fix the PATH created by scons.bat (and other .bat files) to provide a normalized PATH. Some pythons in the 3.6 series are no longer able to handle paths which @@ -96,8 +96,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE would fail when using -Wstrict-prototypes. From Paweł Tomulik: - - Fixed must_contain(), must_not_contain(), etc. to work with substrings - located at zero offset. + - In the testing framework, module TestCommon, fixed must_contain(), + must_not_contain(), and related methods of TestCommon class to work with + substrings located at zero offset. From Richard West: - Add SConstruct.py, Sconstruct.py, sconstruct.py to the search path for the root SConstruct file. -- cgit v0.12 From 063eea321e3e22003e86cbaf52ef5d1273b35758 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 10 Oct 2018 10:39:18 -0400 Subject: Add test to verify Configure's TryCompile works with Cachedir --- test/CacheDir/CacheDir_TryCompile.py | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 test/CacheDir/CacheDir_TryCompile.py diff --git a/test/CacheDir/CacheDir_TryCompile.py b/test/CacheDir/CacheDir_TryCompile.py new file mode 100644 index 0000000..bb22835 --- /dev/null +++ b/test/CacheDir/CacheDir_TryCompile.py @@ -0,0 +1,71 @@ +#!/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 that CacheDir functions with TryCompile. + +With Py3 there was an issue where the generated cache signature from Python Value nodes +could be bytes instead of a string which would fail when combining cache signatures +which ended up a mixture of bytes and strings. +""" + +import os + +import TestSCons + +test = TestSCons.TestSCons() + +cache = test.workpath('cache') + +test.subdir('cache', 'src') + +test.write(['src', 'SConstruct'], """\ +DefaultEnvironment(tools=[]) +env = Environment() +env.CacheDir(r'%(cache)s') + +conf = Configure(env) + +conf.TryCompile('int a;', '.c') + +env = conf.Finish() +""" % locals()) + +# Verify that a normal build works correctly, and clean up. +# This should populate the cache with our derived files. +test.run(chdir = 'src', arguments = '.') + +test.up_to_date(chdir = 'src', arguments = '.') + +test.run(chdir = 'src', arguments = '-c .') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From d372089735e398a3dc88b4327d91dae32fdfff32 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 10 Oct 2018 10:41:06 -0400 Subject: Fix Bug #3212. Using CacheDir with Configure TryCompile with Python 3 was failing because it was yielding a mixture of bytes and strings when generating cachedir signature use to determine file and directory in cachedir to use --- src/engine/SCons/CacheDir.py | 2 ++ src/engine/SCons/Executor.py | 2 ++ src/engine/SCons/Node/FS.py | 5 +++++ src/engine/SCons/Node/Python.py | 13 +++++++++++-- src/engine/SCons/Util.py | 11 +++++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/CacheDir.py b/src/engine/SCons/CacheDir.py index ab80808..ab23f31 100644 --- a/src/engine/SCons/CacheDir.py +++ b/src/engine/SCons/CacheDir.py @@ -221,7 +221,9 @@ class CacheDir(object): return None, None sig = node.get_cachedir_bsig() + subdir = sig[:self.config['prefix_len']].upper() + dir = os.path.join(self.path, subdir) return dir, os.path.join(dir, sig) diff --git a/src/engine/SCons/Executor.py b/src/engine/SCons/Executor.py index bce1549..01d01cd 100644 --- a/src/engine/SCons/Executor.py +++ b/src/engine/SCons/Executor.py @@ -450,6 +450,8 @@ class Executor(object, with_metaclass(NoSlotsPyPy)): """Fetch the signature contents. This is the main reason this class exists, so we can compute this once and cache it regardless of how many target or source Nodes there are. + + Returns bytes """ try: return self._memo['get_contents'] diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index bc15064..5dceaa0 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -3382,6 +3382,8 @@ class File(Base): because multiple targets built by the same action will all have the same build signature, and we have to differentiate them somehow. + + Signature should normally be string of hex digits. """ try: return self.cachesig @@ -3391,10 +3393,13 @@ class File(Base): # Collect signatures for all children children = self.children() sigs = [n.get_cachedir_csig() for n in children] + # Append this node's signature... sigs.append(self.get_contents_sig()) + # ...and it's path sigs.append(self.get_internal_path()) + # Merge this all into a single signature result = self.cachesig = SCons.Util.MD5collect(sigs) return result diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py index 8c47c97..4a62f04 100644 --- a/src/engine/SCons/Node/Python.py +++ b/src/engine/SCons/Node/Python.py @@ -137,6 +137,10 @@ class Value(SCons.Node.Node): return contents def get_contents(self): + """ + Get contents for signature calculations. + :return: bytes + """ text_contents = self.get_text_contents() try: return text_contents.encode() @@ -155,12 +159,17 @@ class Value(SCons.Node.Node): def get_csig(self, calc=None): """Because we're a Python value node and don't have a real timestamp, we get to ignore the calculator and just use the - value contents.""" + value contents. + + Returns string. Ideally string of hex digits. (Not bytes) + """ try: return self.ninfo.csig except AttributeError: pass - contents = self.get_contents() + + contents = self.get_text_contents() + self.get_ninfo().csig = contents return contents diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 424c694..b568ce5 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -1459,6 +1459,11 @@ else: md5 = True def MD5signature(s): + """ + Generate a String of Hex digits representing the md5 signature of the string + :param s: either string or bytes. Normally should be bytes + :return: String of hex digits + """ m = hashlib.md5() try: @@ -1469,6 +1474,11 @@ else: return m.hexdigest() def MD5filesignature(fname, chunksize=65536): + """ + :param fname: + :param chunksize: + :return: String of Hex digits + """ m = hashlib.md5() f = open(fname, "rb") while True: @@ -1479,6 +1489,7 @@ else: f.close() return m.hexdigest() + def MD5collect(signatures): """ Collects a list of signatures into an aggregate signature. -- cgit v0.12 From 91b9ad6de7da6c06ed4d964060065530d0419c90 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 10 Oct 2018 10:42:20 -0400 Subject: Add to CHANGES.txt --- src/CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c8ec110..9b3eec4 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -48,6 +48,8 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Add alternate path to QT install for Centos in qt tool: /usr/lib64/qt-3.3/bin - Fix GH Issue #2580 - # in FRAMEWORKPATH doesn't get properly expanded. The # is left in the command line. + - Fix GH Issue #3212 - Use of Py3 and CacheDir + Configure's TryCompile (or likely and Python Value Nodes) + yielded trying to combine strings and bytes which threw exception. From Andrew Featherstone - Removed unused --warn options from the man page and source code. -- cgit v0.12 From 91cfc1e6d0b099035e74630b73f879c4499f2448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Wed, 10 Oct 2018 21:44:23 +0200 Subject: remove editor junk --- .gitignore | 6 ++++++ testing/framework/.TestCommonTests.py.swp | Bin 16384 -> 0 bytes 2 files changed, 6 insertions(+) delete mode 100644 testing/framework/.TestCommonTests.py.swp diff --git a/.gitignore b/.gitignore index 1807b29..db2cd3a 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,9 @@ htmlcov # VS Code .vscode + +# Editor junk +*.swp +*.bkp +*.bak +*~ diff --git a/testing/framework/.TestCommonTests.py.swp b/testing/framework/.TestCommonTests.py.swp deleted file mode 100644 index fcee08e..0000000 Binary files a/testing/framework/.TestCommonTests.py.swp and /dev/null differ -- cgit v0.12 From d9c776d8ff37fa6d1b9341953c17b231b15f91d6 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 10 Oct 2018 20:45:00 -0400 Subject: fix Value node tests to expect a string and not bytes --- src/engine/SCons/Node/PythonTests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Node/PythonTests.py b/src/engine/SCons/Node/PythonTests.py index 7ef9e52..8a01503 100644 --- a/src/engine/SCons/Node/PythonTests.py +++ b/src/engine/SCons/Node/PythonTests.py @@ -88,15 +88,15 @@ class ValueTestCase(unittest.TestCase): """ v1 = SCons.Node.Python.Value('aaa') csig = v1.get_csig(None) - assert csig.decode() == 'aaa', csig + assert csig == 'aaa', csig v2 = SCons.Node.Python.Value(7) csig = v2.get_csig(None) - assert csig.decode() == '7', csig + assert csig == '7', csig v3 = SCons.Node.Python.Value(None) csig = v3.get_csig(None) - assert csig.decode() == 'None', csig + assert csig == 'None', csig class ValueNodeInfoTestCase(unittest.TestCase): def test___init__(self): -- cgit v0.12 From 866052de70e5a5a051d1c55b1a4b731fda251c9b Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 12 Oct 2018 11:51:40 -0600 Subject: Get a little smarter about finding the scons engine. In the common script stanza, Previous version was generating some paths that were not useful. Make sure the path pulled from package info is not mangled into unsuability. General cleanup. Write error message to stderr instead of stdout in scons.py. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + src/script/scons.py | 101 +++++++++++++++++++++++++------------------------ src/script/sconsign.py | 86 +++++++++++++++++++++-------------------- 3 files changed, 98 insertions(+), 90 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 9b3eec4..56127ae 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -160,6 +160,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Add xz compression format to packaging choices. - Syntax cleanups - trailing blanks, use "is" to compare with None, etc. Three uses of variables not defined are changed. + - Some script changes in trying to find scons engine From Hao Wu - typo in customized decider example in user guide diff --git a/src/script/scons.py b/src/script/scons.py index f2a44f8..d22e76b 100644 --- a/src/script/scons.py +++ b/src/script/scons.py @@ -37,10 +37,18 @@ __date__ = "__DATE__" __developer__ = "__DEVELOPER__" +# This is the entry point to the SCons program. +# The only job of this script is to work out where the guts of the program +# could be and import them, where the real work begins. +# SCons can be invoked several different ways +# - from an installed location +# - from a "local install" copy +# - from a source tree, which has a different dir struture than the other two +# Try to account for all those possibilities. + import os import sys - ############################################################################## # BEGIN STANDARD SCons SCRIPT HEADER # @@ -50,57 +58,53 @@ import sys # should also change other scripts that use this same header. ############################################################################## -# Strip the script directory from sys.path() so on case-insensitive -# (WIN32) systems Python doesn't think that the "scons" script is the -# "SCons" package. Replace it with our own library directories -# (version-specific first, in case they installed by hand there, -# followed by generic) so we pick up the right version of the build -# engine modules if they're in either directory. - - +# compatibility check if (3,0,0) < sys.version_info < (3,5,0) or sys.version_info < (2,7,0): msg = "scons: *** SCons version %s does not run under Python version %s.\n\ -Python < 3.5 is not yet supported.\n" +Python 2.7 or >= 3.5 is required.\n" sys.stderr.write(msg % (__version__, sys.version.split()[0])) sys.exit(1) - -script_dir = os.path.dirname(os.path.realpath(__file__)) - -if script_dir in sys.path: - sys.path.remove(script_dir) +# Strip the script directory from sys.path so on case-insensitive +# (WIN32) systems Python doesn't think that the "scons" script is the +# "SCons" package. +script_dir = os.path.dirname(__file__) +script_path = os.path.realpath(os.path.dirname(__file__)) +if script_path in sys.path: + sys.path.remove(script_path) libs = [] if "SCONS_LIB_DIR" in os.environ: libs.append(os.environ["SCONS_LIB_DIR"]) -# - running from source takes priority (since 2.3.2), excluding SCONS_LIB_DIR settings -script_path = os.path.abspath(os.path.dirname(__file__)) -source_path = os.path.join(script_path, '..', 'engine') -libs.append(source_path) +# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR +source_path = os.path.join(script_path, os.pardir, 'engine') +if os.path.isdir(source_path): + libs.append(source_path) +# add local-install locations local_version = 'scons-local-' + __version__ local = 'scons-local' if script_dir: local_version = os.path.join(script_dir, local_version) local = os.path.join(script_dir, local) -libs.append(os.path.abspath(local_version)) -libs.append(os.path.abspath(local)) +if os.path.isdir(local_version): + libs.append(os.path.abspath(local_version)) +if os.path.isdir(local): + libs.append(os.path.abspath(local)) scons_version = 'scons-%s' % __version__ # preferred order of scons lookup paths prefs = [] - -# - running from egg check +# if we can find package information, use it try: import pkg_resources except ImportError: pass else: - # when running from an egg add the egg's directory try: d = pkg_resources.get_distribution('scons') except pkg_resources.DistributionNotFound: @@ -109,18 +113,18 @@ else: prefs.append(d.location) if sys.platform == 'win32': - # sys.prefix is (likely) C:\Python*; - # check only C:\Python*. + # Use only sys.prefix on Windows prefs.append(sys.prefix) prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages')) else: # On other (POSIX) platforms, things are more complicated due to - # the variety of path names and library locations. Try to be smart - # about it. + # the variety of path names and library locations. + # Build up some possibilities, then transform them into candidates + temp = [] if script_dir == 'bin': # script_dir is `pwd`/bin; # check `pwd`/lib/scons*. - prefs.append(os.getcwd()) + temp.append(os.getcwd()) else: if script_dir == '.' or script_dir == '': script_dir = os.getcwd() @@ -128,42 +132,41 @@ else: if tail == "bin": # script_dir is /foo/bin; # check /foo/lib/scons*. - prefs.append(head) + temp.append(head) head, tail = os.path.split(sys.prefix) if tail == "usr": # sys.prefix is /foo/usr; # check /foo/usr/lib/scons* first, # then /foo/usr/local/lib/scons*. - prefs.append(sys.prefix) - prefs.append(os.path.join(sys.prefix, "local")) + temp.append(sys.prefix) + temp.append(os.path.join(sys.prefix, "local")) elif tail == "local": h, t = os.path.split(head) if t == "usr": # sys.prefix is /foo/usr/local; # check /foo/usr/local/lib/scons* first, # then /foo/usr/lib/scons*. - prefs.append(sys.prefix) - prefs.append(head) + temp.append(sys.prefix) + temp.append(head) else: # sys.prefix is /foo/local; # check only /foo/local/lib/scons*. - prefs.append(sys.prefix) + temp.append(sys.prefix) else: # sys.prefix is /foo (ends in neither /usr or /local); # check only /foo/lib/scons*. - prefs.append(sys.prefix) + temp.append(sys.prefix) + + # suffix these to add to our original prefs: + prefs.extend([os.path.join(x, 'lib') for x in temp]) + prefs.extend([os.path.join(x, 'lib', 'python' + sys.version[:3], + 'site-packages') for x in temp]) - temp = [os.path.join(x, 'lib') for x in prefs] - temp.extend([os.path.join(x, - 'lib', - 'python' + sys.version[:3], - 'site-packages') for x in prefs]) - prefs = temp # Add the parent directory of the current python's library to the - # preferences. On SuSE-91/AMD64, for example, this is /usr/lib64, - # not /usr/lib. + # preferences. This picks up differences between, e.g., lib and lib64, + # and finds the base location in case of a non-copying virtualenv. try: libpath = os.__file__ except AttributeError: @@ -177,9 +180,9 @@ else: prefs.append(libpath) # Look first for 'scons-__version__' in all of our preference libs, -# then for 'scons'. -libs.extend([os.path.join(x, scons_version) for x in prefs]) -libs.extend([os.path.join(x, 'scons') for x in prefs]) +# then for 'scons'. Skip paths that do not exist. +libs.extend([os.path.join(x, scons_version) for x in prefs if os.path.isdir(x)]) +libs.extend([os.path.join(x, 'scons') for x in prefs if os.path.isdir(x)]) sys.path = libs + sys.path @@ -191,9 +194,9 @@ if __name__ == "__main__": try: import SCons.Script except ImportError: - print("SCons import failed. Unable to find engine files in:") + sys.stderr.write("SCons import failed. Unable to find engine files in:\n") for path in libs: - print(" {}".format(path)) + sys.stderr.write(" {}\n".format(path)) raise # this does all the work, and calls sys.exit diff --git a/src/script/sconsign.py b/src/script/sconsign.py index 559dffe..2337f67 100644 --- a/src/script/sconsign.py +++ b/src/script/sconsign.py @@ -49,48 +49,53 @@ import sys # should also change other scripts that use this same header. ############################################################################## -# Strip the script directory from sys.path() so on case-insensitive +# compatibility check +if (3,0,0) < sys.version_info < (3,5,0) or sys.version_info < (2,7,0): + msg = "scons: *** SCons version %s does not run under Python version %s.\n\ +Python 2.7 or >= 3.5 is required.\n" + sys.stderr.write(msg % (__version__, sys.version.split()[0])) + sys.exit(1) + +# Strip the script directory from sys.path so on case-insensitive # (WIN32) systems Python doesn't think that the "scons" script is the -# "SCons" package. Replace it with our own library directories -# (version-specific first, in case they installed by hand there, -# followed by generic) so we pick up the right version of the build -# engine modules if they're in either directory. - - -script_dir = os.path.dirname(os.path.realpath(__file__)) - -if script_dir in sys.path: - sys.path.remove(script_dir) +# "SCons" package. +script_dir = os.path.dirname(__file__) +script_path = os.path.realpath(os.path.dirname(__file__)) +if script_path in sys.path: + sys.path.remove(script_path) libs = [] if "SCONS_LIB_DIR" in os.environ: libs.append(os.environ["SCONS_LIB_DIR"]) -# - running from source takes priority (since 2.3.2), excluding SCONS_LIB_DIR settings -script_path = os.path.abspath(os.path.dirname(__file__)) -source_path = os.path.join(script_path, '..', 'engine') -libs.append(source_path) +# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR +source_path = os.path.join(script_path, os.pardir, 'engine') +if os.path.isdir(source_path): + libs.append(source_path) +# add local-install locations local_version = 'scons-local-' + __version__ local = 'scons-local' if script_dir: local_version = os.path.join(script_dir, local_version) local = os.path.join(script_dir, local) -libs.append(os.path.abspath(local_version)) -libs.append(os.path.abspath(local)) +if os.path.isdir(local_version): + libs.append(os.path.abspath(local_version)) +if os.path.isdir(local): + libs.append(os.path.abspath(local)) scons_version = 'scons-%s' % __version__ # preferred order of scons lookup paths prefs = [] +# if we can find package information, use it try: import pkg_resources except ImportError: pass else: - # when running from an egg add the egg's directory try: d = pkg_resources.get_distribution('scons') except pkg_resources.DistributionNotFound: @@ -99,18 +104,18 @@ else: prefs.append(d.location) if sys.platform == 'win32': - # sys.prefix is (likely) C:\Python*; - # check only C:\Python*. + # Use only sys.prefix on Windows prefs.append(sys.prefix) prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages')) else: # On other (POSIX) platforms, things are more complicated due to - # the variety of path names and library locations. Try to be smart - # about it. + # the variety of path names and library locations. + # Build up some possibilities, then transform them into candidates + temp = [] if script_dir == 'bin': # script_dir is `pwd`/bin; # check `pwd`/lib/scons*. - prefs.append(os.getcwd()) + temp.append(os.getcwd()) else: if script_dir == '.' or script_dir == '': script_dir = os.getcwd() @@ -118,42 +123,41 @@ else: if tail == "bin": # script_dir is /foo/bin; # check /foo/lib/scons*. - prefs.append(head) + temp.append(head) head, tail = os.path.split(sys.prefix) if tail == "usr": # sys.prefix is /foo/usr; # check /foo/usr/lib/scons* first, # then /foo/usr/local/lib/scons*. - prefs.append(sys.prefix) - prefs.append(os.path.join(sys.prefix, "local")) + temp.append(sys.prefix) + temp.append(os.path.join(sys.prefix, "local")) elif tail == "local": h, t = os.path.split(head) if t == "usr": # sys.prefix is /foo/usr/local; # check /foo/usr/local/lib/scons* first, # then /foo/usr/lib/scons*. - prefs.append(sys.prefix) - prefs.append(head) + temp.append(sys.prefix) + temp.append(head) else: # sys.prefix is /foo/local; # check only /foo/local/lib/scons*. - prefs.append(sys.prefix) + temp.append(sys.prefix) else: # sys.prefix is /foo (ends in neither /usr or /local); # check only /foo/lib/scons*. - prefs.append(sys.prefix) + temp.append(sys.prefix) + + # suffix these to add to our original prefs: + prefs.extend([os.path.join(x, 'lib') for x in temp]) + prefs.extend([os.path.join(x, 'lib', 'python' + sys.version[:3], + 'site-packages') for x in temp]) - temp = [os.path.join(x, 'lib') for x in prefs] - temp.extend([os.path.join(x, - 'lib', - 'python' + sys.version[:3], - 'site-packages') for x in prefs]) - prefs = temp # Add the parent directory of the current python's library to the - # preferences. On SuSE-91/AMD64, for example, this is /usr/lib64, - # not /usr/lib. + # preferences. This picks up differences between, e.g., lib and lib64, + # and finds the base location in case of a non-copying virtualenv. try: libpath = os.__file__ except AttributeError: @@ -167,9 +171,9 @@ else: prefs.append(libpath) # Look first for 'scons-__version__' in all of our preference libs, -# then for 'scons'. -libs.extend([os.path.join(x, scons_version) for x in prefs]) -libs.extend([os.path.join(x, 'scons') for x in prefs]) +# then for 'scons'. Skip paths that do not exist. +libs.extend([os.path.join(x, scons_version) for x in prefs if os.path.isdir(x)]) +libs.extend([os.path.join(x, 'scons') for x in prefs if os.path.isdir(x)]) sys.path = libs + sys.path -- cgit v0.12 From a61f52da75cad382d482ae13a9e3d30d4870f87b Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Sun, 14 Oct 2018 04:45:24 +0200 Subject: Allow to override build date with SOURCE_DATE_EPOCH in order to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. Also consistently use ISO 8601 date format to be understood everywhere. Also use gmtime to be independent of timezone. --- SConstruct | 2 +- doc/SConscript | 5 +++-- src/CHANGES.txt | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index f644d6d..773bacb 100644 --- a/SConstruct +++ b/SConstruct @@ -73,7 +73,7 @@ zip = whereis('zip') # date = ARGUMENTS.get('DATE') if not date: - date = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(time.time())) + date = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))) developer = ARGUMENTS.get('DEVELOPER') if not developer: diff --git a/doc/SConscript b/doc/SConscript index 82b29a6..5f3d559 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -131,8 +131,9 @@ if skip_doc: if not os.path.isdir(scdir): os.makedirs(scdir) - import datetime - today = datetime.date.today().strftime("%m/%d/%Y") + import time + today = time.strftime("%Y-%m-%d", + time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))) version = env.subst('$VERSION') for m in man_page_list: man, _ = os.path.splitext(m) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 56127ae..908df6b 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -162,6 +162,11 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE Three uses of variables not defined are changed. - Some script changes in trying to find scons engine + From Bernhard M. Wiedemann: + - Allow to override build date with SOURCE_DATE_EPOCH for SCons itself, + but not for software built with SCons. + - Datestamps in docs and embedded in code use ISO 8601 format and UTC + From Hao Wu - typo in customized decider example in user guide -- cgit v0.12 From 55c4cebac66372da7a27c7b1e00d435dc2abe27c Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 15 Oct 2018 10:56:32 -0400 Subject: Reordered and revised some text. Also added note about adding new info in order of contributors last name. --- src/CHANGES.txt | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 908df6b..95738b3 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,14 +6,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - - From Daniel Moody: - - Updated FS.py to handle removal of splitunc function from python 3.7 - - Updated the vc.py to ignore MSVS versions where not compiler could be found - - From Matthew Marinets: - - Fixed an issue that caused the Java emitter to incorrectly parse arguments to constructors that - implemented a class. +** Please add to this version's notes ordered by contributors last name. NOT newest at top of list ** From Bernard Blackham: - Fixed handling of side-effects in task master (fixes #3013). @@ -50,7 +43,12 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE command line. - Fix GH Issue #3212 - Use of Py3 and CacheDir + Configure's TryCompile (or likely and Python Value Nodes) yielded trying to combine strings and bytes which threw exception. - + - Updated logic for mingw and clang on win32 to search default tool install paths if not + found in normal SCons PATH. If the user specifies PATH or tool specific paths they + will be used and the default paths below will be ignored. + - Default path for clang/clangxx : C:\Program Files\LLVM\bin + - Default path for mingw : c:\MinGW\bin + From Andrew Featherstone - Removed unused --warn options from the man page and source code. @@ -59,6 +57,10 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE objects when SCons runs with Python 3. - Added missing FORTRANMODDIRPREFIX to the gfortran tool. + From Matthew Marinets: + - Fixed an issue that caused the Java emitter to incorrectly parse arguments to constructors that + implemented a class. + From Fredrik Medley: - Fix exception when printing of EnviromentError messages. Specifically, this fixes error reporting of the race condition when @@ -78,14 +80,8 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Set the pickling protocal back to highest which was causing issues with variant dir tests. This will cause issues if reading sconsigns pickled with the previous lower protocal. - - - From William Deegan: - - Updated logic for mingw and clang on win32 to search default tool install paths if not - found in normal SCons PATH. If the user specifies PATH or tool specific paths they - will be used and the default paths below will be ignored. - - Default path for clang/clangxx : C:\Program Files\LLVM\bin - - Default path for mingw : c:\MinGW\bin + - Updated FS.py to handle removal of splitunc function from python 3.7 + - Updated the vc.py to ignore MSVS versions where not compiler could be found From Gary Oberbrunner: - Fix bug when Installing multiple subdirs outside the source tree @@ -163,19 +159,16 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Some script changes in trying to find scons engine From Bernhard M. Wiedemann: - - Allow to override build date with SOURCE_DATE_EPOCH for SCons itself, - but not for software built with SCons. - - Datestamps in docs and embedded in code use ISO 8601 format and UTC - - From Hao Wu - - typo in customized decider example in user guide + - Update SCons' internal scons build logic to allow overriding build date + with SOURCE_DATE_EPOCH for SCons itself. + - Change the datestamps in SCons' docs and embedded in code use ISO 8601 format and UTC From Hao Wu + - Typo in customized decider example in user guide - Replace usage of unittest.TestSuite with unittest.main() (fix #3113) - RELEASE 3.0.1 - Mon, 12 Nov 2017 15:31:33 -0700 From Daniel Moody: -- cgit v0.12