From 680805f3ff9fc0c2823f084ff2f5b31e38f9471f Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Fri, 10 Aug 2018 15:45:54 -0500 Subject: Updated FS to handle removal of splitunc function from python 3.7 --- src/engine/SCons/Node/FS.py | 5 ++++- src/engine/SCons/Node/FSTests.py | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 9a48432..54cd423 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -132,7 +132,10 @@ def initialize_do_splitdrive(): global do_splitdrive global has_unc drive, path = os.path.splitdrive('X:/foo') - has_unc = hasattr(os.path, 'splitunc') + # 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') + or os.path.splitdrive(r'\\split\drive\test')[0] == r'\\split\drive') do_splitdrive = not not drive or has_unc diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 273f809..2c4dcfa 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1657,7 +1657,12 @@ class FSTestCase(_tempdirTestCase): import ntpath x = test.workpath(*dirs) drive, path = ntpath.splitdrive(x) - unc, path = ntpath.splitunc(path) + try: + unc, path = ntpath.splitunc(path) + except AttributeError: + # could be python 3.7 or newer, make sure splitdrive can do UNC + assert ntpath.splitdrive(r'\\split\drive\test')[0] == r'\\split\drive' + pass path = strip_slash(path) return '//' + path[1:] -- cgit v0.12 From a582b0671ee3dbf152dfec15bef968410af5ece8 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Fri, 10 Aug 2018 16:00:14 -0500 Subject: Switched test to use assertFalse because of deprication warning in 3.7 --- src/engine/SCons/Node/FSTests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 2c4dcfa..698f574 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -605,7 +605,7 @@ class VariantDirTestCase(unittest.TestCase): print("File `%s' alter_targets() `%s' != expected `%s'" % (f, tp, expect)) errors = errors + 1 - self.failIf(errors) + self.assertFalse(errors) class BaseTestCase(_tempdirTestCase): def test_stat(self): -- cgit v0.12 From 47db1a99a1017144a10e0f1537b1d6b585bae786 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Fri, 10 Aug 2018 16:01:53 -0500 Subject: updated CHANGES.txt --- src/CHANGES.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 51cbc27..58b8a7e 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -7,7 +7,10 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - From Matthew Marinets + From Daniel Moody: + - Updated FS.py to handle removal of splitunc function from python 3.7 + + From Matthew Marinets: - Fixed an issue that caused the Java emitter to incorrectly parse arguments to constructors that implemented a class. -- cgit v0.12