From f8ce26e209fc61957a8202a01edf42ddd3e25959 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 26 Nov 2021 11:46:54 -0700 Subject: Fix sider complaints and add missed CHANGES.txt update Signed-off-by: Mats Wichmann --- CHANGES.txt | 8 ++++++++ runtest.py | 2 +- test/scons-time/run/config/python.py | 16 +++++++++++----- test/scons-time/run/option/python.py | 10 ++++++---- test/sconsign/script/SConsignFile.py | 18 ++++++++++++------ test/sconsign/script/Signatures.py | 18 ++++++++++++------ test/sconsign/script/no-SConsignFile.py | 18 ++++++++++++------ 7 files changed, 62 insertions(+), 28 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1ef39aa..881a3f8 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,6 +13,14 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Whatever John Doe did. + From Mats Wichmann: + - Tweak definition of default site_scons paths on Windows to conform + to conventions, drop a Py2 workaround, and pick as better "system" path + (old one remains supported). + - Fix testsuite to work on Windows systems where there is no usable + assocation for running .py files (there are five tests where we need + to do this for internal reasons, these are skipped now). + RELEASE 4.3.0 - Tue, 16 Nov 2021 18:12:46 -0700 diff --git a/runtest.py b/runtest.py index 54640a1..7677a24 100755 --- a/runtest.py +++ b/runtest.py @@ -259,7 +259,7 @@ if args.output: # --- define helpers ---- if sys.platform == 'win32': - # thanks to Bret Cannon for this recipe + # thanks to Brett Cannon for this recipe import ctypes shlwapi = ctypes.OleDLL('shlwapi') diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py index f1b8fb2..129ea0f 100644 --- a/test/scons-time/run/config/python.py +++ b/test/scons-time/run/config/python.py @@ -43,12 +43,17 @@ test.write_sample_project('foo.tar.gz') my_python_py = test.workpath('my_python.py') -test.write('config', """\ +test.write( + 'config', + """\ python = r'%(my_python_py)s' -""" % locals()) +""", +) -test.write(my_python_py, """\ -#!%(_python_)s +test.write( + my_python_py, + f"""\ +#!{_python_} import sys profile = '' for arg in sys.argv[1:]: @@ -56,7 +61,8 @@ for arg in sys.argv[1:]: profile = arg[10:] break print('my_python.py: %%s' %% profile) -""" % locals()) +""", +) os.chmod(my_python_py, 0o755) diff --git a/test/scons-time/run/option/python.py b/test/scons-time/run/option/python.py index d10267a..02890e7 100644 --- a/test/scons-time/run/option/python.py +++ b/test/scons-time/run/option/python.py @@ -32,7 +32,6 @@ import os import TestSCons_time from TestCmd import NEED_HELPER -from TestCmd import IS_WINDOWS from TestSCons_time import _python_ test = TestSCons_time.TestSCons_time() @@ -44,8 +43,10 @@ test.write_sample_project('foo.tar.gz') my_python_py = test.workpath('my_python.py') -test.write(my_python_py, """\ -#!%(_python_)s +test.write( + my_python_py, + f"""\ +#!{_python_} import sys profile = '' for arg in sys.argv[1:]: @@ -53,7 +54,8 @@ for arg in sys.argv[1:]: profile = arg[10:] break sys.stdout.write('my_python.py: %%s\\n' %% profile) -""" % locals()) +""", +) os.chmod(my_python_py, 0o755) diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py index 569e5e6..d19cfab 100644 --- a/test/sconsign/script/SConsignFile.py +++ b/test/sconsign/script/SConsignFile.py @@ -44,7 +44,9 @@ test.subdir('sub1', 'sub2') fake_cc_py = test.workpath('fake_cc.py') fake_link_py = test.workpath('fake_link.py') -test.write(fake_cc_py, fr"""#!{_python_} +test.write( + fake_cc_py, + fr"""#!{_python_} import os import re import sys @@ -75,10 +77,12 @@ with open(sys.argv[2], 'w') as outf, open(sys.argv[3], 'r') as ifp: process(ifp, outf) sys.exit(0) -""" +""", ) -test.write(fake_link_py, fr"""#!{_python_} +test.write( + fake_link_py, + fr"""#!{_python_} import sys with open(sys.argv[1], 'w') as outf, open(sys.argv[2], 'r') as ifp: @@ -86,7 +90,7 @@ with open(sys.argv[1], 'w') as outf, open(sys.argv[2], 'r') as ifp: outf.write(ifp.read()) sys.exit(0) -""" +""", ) test.chmod(fake_cc_py, 0o755) @@ -103,7 +107,9 @@ sub2_hello_obj = 'sub2/hello.obj' sub2_inc1_h = 'sub2/inc1.h' sub2_inc2_h = 'sub2/inc2.h' -test.write(['SConstruct'], f"""\ +test.write( + ['SConstruct'], + f"""\ SConsignFile() env1 = Environment( PROGSUFFIX='.exe', @@ -115,7 +121,7 @@ env1.PrependENVPath('PATHEXT', '.PY') env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH=['sub2']) env2.Program('sub2/hello.c') -""" +""", ) # TODO in the above, we would normally want to run a python program # using "our python" like this: diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py index b5db3f9..ef8bac0 100644 --- a/test/sconsign/script/Signatures.py +++ b/test/sconsign/script/Signatures.py @@ -62,7 +62,9 @@ test.subdir('sub1', 'sub2') fake_cc_py = test.workpath('fake_cc.py') fake_link_py = test.workpath('fake_link.py') -test.write(fake_cc_py, fr"""#!{_python_} +test.write( + fake_cc_py, + fr"""#!{_python_} import os import re import sys @@ -93,10 +95,12 @@ with open(sys.argv[2], 'w') as outf, open(sys.argv[3], 'r') as ifp: process(ifp, outf) sys.exit(0) -""" +""", ) -test.write(fake_link_py, fr"""#!{_python_} +test.write( + fake_link_py, + fr"""#!{_python_} import sys with open(sys.argv[1], 'w') as outf, open(sys.argv[2], 'r') as ifp: @@ -104,13 +108,15 @@ with open(sys.argv[1], 'w') as outf, open(sys.argv[2], 'r') as ifp: outf.write(ifp.read()) sys.exit(0) -""" +""", ) test.chmod(fake_cc_py, 0o755) test.chmod(fake_link_py, 0o755) -test.write('SConstruct', f""" +test.write( + 'SConstruct', + f""" SConsignFile(None) Decider('timestamp-newer') env1 = Environment( @@ -126,7 +132,7 @@ env1.PrependENVPath('PATHEXT', '.PY') env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH=['sub2']) env2.Program('sub2/hello.c') -""" +""", ) # TODO in the above, we would normally want to run a python program # using "our python" like this: diff --git a/test/sconsign/script/no-SConsignFile.py b/test/sconsign/script/no-SConsignFile.py index f06a2d0..7a41c72 100644 --- a/test/sconsign/script/no-SConsignFile.py +++ b/test/sconsign/script/no-SConsignFile.py @@ -56,7 +56,9 @@ database_name = test.get_sconsignname() fake_cc_py = test.workpath('fake_cc.py') fake_link_py = test.workpath('fake_link.py') -test.write(fake_cc_py, fr"""#!{_python_} +test.write( + fake_cc_py, + fr"""#!{_python_} import os import re import sys @@ -87,10 +89,12 @@ with open(sys.argv[2], 'w') as outf, open(sys.argv[3], 'r') as ifp: process(ifp, outf) sys.exit(0) -""" +""", ) -test.write(fake_link_py, fr"""#!{_python_} +test.write( + fake_link_py, + fr"""#!{_python_} import sys with open(sys.argv[1], 'w') as outf, open(sys.argv[2], 'r') as ifp: @@ -98,7 +102,7 @@ with open(sys.argv[1], 'w') as outf, open(sys.argv[2], 'r') as ifp: outf.write(ifp.read()) sys.exit(0) -""" +""", ) test.chmod(fake_cc_py, 0o755) @@ -115,7 +119,9 @@ sub2_hello_obj = 'sub2/hello.obj' sub2_inc1_h = 'sub2/inc1.h' sub2_inc2_h = 'sub2/inc2.h' -test.write(['SConstruct'], f""" +test.write( + ['SConstruct'], + f""" SConsignFile(None) env1 = Environment( PROGSUFFIX='.exe', @@ -130,7 +136,7 @@ env1.PrependENVPath('PATHEXT', '.PY') env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH=['sub2']) env2.Program('sub2/hello.c') -""" +""", ) # TODO in the above, we would normally want to run a python program # using "our python" like this: -- cgit v0.12