summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2020-05-09 16:00:54 (GMT)
committerMats Wichmann <mats@linux.com>2020-05-12 19:05:32 (GMT)
commit309433587513c59d51ab167bae1795cd9b157c47 (patch)
tree1f7c803f8a520102faed4a82f2c9dbbb01346ccd
parent190bc3bfbb582d49480bb24d90bf6e09b596488c (diff)
downloadSCons-309433587513c59d51ab167bae1795cd9b157c47.zip
SCons-309433587513c59d51ab167bae1795cd9b157c47.tar.gz
SCons-309433587513c59d51ab167bae1795cd9b157c47.tar.bz2
Python 3.9 support
Fixes to ActionTests to support bytecode, etc. Eliminate some warnings when running testsuite (rawstrings) Signed-off-by: Mats Wichmann <mats@linux.com>
-rwxr-xr-xCHANGES.txt1
-rw-r--r--SCons/ActionTests.py18
-rw-r--r--SCons/cpp.py8
-rw-r--r--test/Dir/DriveAbsPath.py2
-rw-r--r--test/LINK/applelink.py4
5 files changed, 17 insertions, 16 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index f336170..f02747c 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -142,6 +142,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
has different function.
- Update xml files in SCons to reflect changed relative paths after
code restructuring (src/engine/SCons -> SCons)
+ - Preliminary Python 3.9 support - elimination of some warnings.
diff --git a/SCons/ActionTests.py b/SCons/ActionTests.py
index 4784abf..bb4aa40 100644
--- a/SCons/ActionTests.py
+++ b/SCons/ActionTests.py
@@ -1512,11 +1512,11 @@ class CommandGeneratorActionTestCase(unittest.TestCase):
# Since the python bytecode has per version differences, we need different expected results per version
func_matches = {
- (2, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
+ (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
}
meth_matches = [
@@ -1691,20 +1691,20 @@ class FunctionActionTestCase(unittest.TestCase):
pass
func_matches = {
- (2, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
+ (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
}
meth_matches = {
- (2, 7): bytearray(b'1, 1, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 5): bytearray(b'1, 1, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 6): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 7): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 8): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),
+ (3, 9): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),
}
def factory(act, **kw):
@@ -1945,11 +1945,11 @@ class LazyActionTestCase(unittest.TestCase):
pass
func_matches = {
- (2, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
+ (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
}
meth_matches = [
@@ -2004,11 +2004,11 @@ class ActionCallerTestCase(unittest.TestCase):
pass
matches = {
- (2, 7): b'd\x00\x00S',
(3, 5): b'd\x00\x00S',
(3, 6): b'd\x00S\x00',
(3, 7): b'd\x00S\x00',
(3, 8): b'd\x00S\x00',
+ (3, 9): b'd\x00S\x00',
}
@@ -2205,11 +2205,11 @@ class ObjectContentsTestCase(unittest.TestCase):
# Since the python bytecode has per version differences, we need different expected results per version
expected = {
- (2, 7): bytearray(b'3, 3, 0, 0,(),(),(|\x00\x00S),(),()'),
(3, 5): bytearray(b'3, 3, 0, 0,(),(),(|\x00\x00S),(),()'),
(3, 6): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),
(3, 7): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),
(3, 8): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),
+ (3, 9): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),
}
c = SCons.Action._function_contents(func1)
@@ -2227,8 +2227,6 @@ class ObjectContentsTestCase(unittest.TestCase):
# Since the python bytecode has per version differences, we need different expected results per version
expected = {
- (2, 7): bytearray(
- b"{TestClass:__main__}[[[(<type \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<type \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01\x00|\x00\x00_\x00\x00d\x02\x00|\x00\x00_\x01\x00d\x00\x00S),(),(),2, 2, 0, 0,(),(),(d\x00\x00S),(),()}}{{{a=a,b=b}}}"),
(3, 5): bytearray(
b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01\x00|\x00\x00_\x00\x00d\x02\x00|\x00\x00_\x01\x00d\x00\x00S),(),(),2, 2, 0, 0,(),(),(d\x00\x00S),(),()}}{{{a=a,b=b}}}"),
(3, 6): bytearray(
@@ -2237,6 +2235,8 @@ class ObjectContentsTestCase(unittest.TestCase):
b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"),
(3, 8): bytearray(
b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"),
+ (3, 9): bytearray(
+ b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"),
}
assert c == expected[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + "\n" + repr(
@@ -2250,11 +2250,11 @@ class ObjectContentsTestCase(unittest.TestCase):
# Since the python bytecode has per version differences, we need different expected results per version
expected = {
- (2, 7): bytearray(b'0, 0, 0, 0,(Hello, World!),(),(d\x00\x00GHd\x01\x00S)'),
(3, 5): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00\x00d\x00\x00\x83\x01\x00\x01d\x01\x00S)'),
(3, 6): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'),
(3, 7): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'),
(3, 8): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'),
+ (3, 9): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'),
}
assert c == expected[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + "\n" + repr(expected[
diff --git a/SCons/cpp.py b/SCons/cpp.py
index 89d8dac..c56c965 100644
--- a/SCons/cpp.py
+++ b/SCons/cpp.py
@@ -105,10 +105,10 @@ CPP_Expression = re.compile(e, re.M)
# A list with RE to cleanup CPP Expressions (tuples)
# We should remove all comments and carriage returns (\r) before evaluating
CPP_Expression_Cleaner_List = [
- "/\*.*\*/",
- "/\*.*",
- "//.*",
- "\r"
+ r"/\*.*\*/",
+ r"/\*.*",
+ r"//.*",
+ r"\r"
]
CPP_Expression_Cleaner_RE = re.compile(
r"\s*(" + "|".join(CPP_Expression_Cleaner_List) + ")")
diff --git a/test/Dir/DriveAbsPath.py b/test/Dir/DriveAbsPath.py
index 829cef2..ab29594 100644
--- a/test/Dir/DriveAbsPath.py
+++ b/test/Dir/DriveAbsPath.py
@@ -24,7 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-"""
+r"""
Test to confirm that Dir(drive_path).abspath works on Windows. This verifies
that SCons no longer has an issue with Dir('T:').abspath returning 'T:\T:'.
Instead, it verifies that Dir('T:') correctly returns an instance of the
diff --git a/test/LINK/applelink.py b/test/LINK/applelink.py
index 906c929..55e265a 100644
--- a/test/LINK/applelink.py
+++ b/test/LINK/applelink.py
@@ -86,7 +86,7 @@ for SHLIBVERSION, APPLELINK_CURRENT_VERSION, APPLELINK_COMPATIBILITY_VERSION, sh
# **locals())
otool_output = "libfoo.{SHLIBVERSION}.dylib:\n\tlibfoo.{SHLIBVERSION}.dylib (compatibility version {APPLELINK_COMPATIBILITY_VERSION}, current version {APPLELINK_CURRENT_VERSION})\n\t/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version REPLACEME)\n".format(**locals())
otool_output = re.escape(otool_output)
- otool_output = otool_output.replace('REPLACEME','\d+\.\d+\.\d+')
+ otool_output = otool_output.replace('REPLACEME',r'\d+\.\d+\.\d+')
test.run(program='/usr/bin/otool', arguments='-L libfoo.%s.dylib' % SHLIBVERSION, stdout=otool_output, match=TestSCons.match_re_dotall)
@@ -145,7 +145,7 @@ for SHLIBVERSION, \
APPLELINK_COMPATIBILITY_VERSION = '0.0.0'
otool_output = "libfoo.{SHLIBVERSION}.dylib:\n\tlibfoo.{SHLIBVERSION}.dylib (compatibility version {APPLELINK_COMPATIBILITY_VERSION}, current version {APPLELINK_CURRENT_VERSION})\n\t/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version REPLACEME)\n".format(
**locals())
- otool_output = re.escape(otool_output).replace('REPLACEME','\d+\.\d+\.\d+')
+ otool_output = re.escape(otool_output).replace('REPLACEME',r'\d+\.\d+\.\d+')
test.run(program='/usr/bin/otool', arguments='-L libfoo.%s.dylib' % SHLIBVERSION, stdout=otool_output, match=TestSCons.match_re_dotall)