From 7c4bc9a79c20f2ac1e8c5f25957fbcad87e7ff56 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 6 May 2020 20:03:49 -0700 Subject: [ci skip] Fixed to use new SCons dir location --- scripts/scons-configure-cache.py | 2 +- scripts/scons.py | 2 +- scripts/sconsign.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/scons-configure-cache.py b/scripts/scons-configure-cache.py index 62cab56..da0e848 100644 --- a/scripts/scons-configure-cache.py +++ b/scripts/scons-configure-cache.py @@ -67,7 +67,7 @@ if "SCONS_LIB_DIR" in os.environ: libs.append(os.environ["SCONS_LIB_DIR"]) # running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR -source_path = os.path.join(script_path, os.pardir, 'src', 'engine') +source_path = os.path.join(script_path, os.pardir) if os.path.isdir(source_path): libs.append(source_path) diff --git a/scripts/scons.py b/scripts/scons.py index 1dc6c78..9af9897 100755 --- a/scripts/scons.py +++ b/scripts/scons.py @@ -61,7 +61,7 @@ if "SCONS_LIB_DIR" in os.environ: libs.append(os.environ["SCONS_LIB_DIR"]) # running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR -source_path = os.path.join(script_path, os.pardir, 'src', 'engine') +source_path = os.path.join(script_path, os.pardir) if os.path.isdir(source_path): libs.append(source_path) diff --git a/scripts/sconsign.py b/scripts/sconsign.py index 493bd40..0edd05c 100644 --- a/scripts/sconsign.py +++ b/scripts/sconsign.py @@ -59,7 +59,7 @@ if "SCONS_LIB_DIR" in os.environ: libs.append(os.environ["SCONS_LIB_DIR"]) # running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR -source_path = os.path.join(script_path, os.pardir, 'src', 'engine') +source_path = os.path.join(script_path, os.pardir) if os.path.isdir(source_path): libs.append(source_path) -- cgit v0.12 From 463ec8562a726d502c9e6fb5ad44368140bf2a09 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 9 May 2020 10:05:49 -0600 Subject: python tool not default + minor wording tweaks Do not add the python tool (which adds Python suffices to SourceFileScanner) in the list of default tools. At the moment, it causes problems for SCons' own documentation build. Minor wording fix in python tool doc. Signed-off-by: Mats Wichmann --- SCons/Tool/__init__.py | 14 +++++++++----- SCons/Tool/python.xml | 7 ++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/SCons/Tool/__init__.py b/SCons/Tool/__init__.py index 4cb77c0..7aab554 100644 --- a/SCons/Tool/__init__.py +++ b/SCons/Tool/__init__.py @@ -1275,13 +1275,17 @@ def tool_list(platform, env): 'tar', 'zip', # File builders (text) 'textfile', - # Python scanner tool - 'python', ], env) - tools = ([linker, c_compiler, cxx_compiler, - fortran_compiler, assembler, ar, d_compiler] - + other_tools) + tools = [ + linker, + c_compiler, + cxx_compiler, + fortran_compiler, + assembler, + ar, + d_compiler, + ] + other_tools return [x for x in tools if x] diff --git a/SCons/Tool/python.xml b/SCons/Tool/python.xml index e3f7da3..17cb564 100644 --- a/SCons/Tool/python.xml +++ b/SCons/Tool/python.xml @@ -26,9 +26,10 @@ See its __doc__ string for a discussion of the format. -Loads the Python scanner scanner into the invoking environment. When loaded, the scanner will -attempt to find implicit dependencies for any Python source files in the list of sources -provided to an actual that uses this environment. +Loads the Python source scanner into the invoking environment. +When loaded, the scanner will attempt to find implicit +dependencies for any Python source files in the list of sources +provided to an Action that uses this environment. -- cgit v0.12 From 9cc2cdda99866ef7f9241bb762ab1d03989be124 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 9 May 2020 12:39:06 -0600 Subject: Add version note for Python tool [ci skip] Signed-off-by: Mats Wichmann --- SCons/Tool/python.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/SCons/Tool/python.xml b/SCons/Tool/python.xml index 17cb564..0e9fbbc 100644 --- a/SCons/Tool/python.xml +++ b/SCons/Tool/python.xml @@ -31,6 +31,7 @@ When loaded, the scanner will attempt to find implicit dependencies for any Python source files in the list of sources provided to an Action that uses this environment. +Available since &scons; 4.0.. -- cgit v0.12 From 13add860052487b3e068b216640de1e2bc309d88 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 9 May 2020 20:21:25 -0700 Subject: Address a few remaining issues with tests for issue #3516 --- SCons/Node/FSTests.py | 89 +++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/SCons/Node/FSTests.py b/SCons/Node/FSTests.py index 8271c0f..71798a9 100644 --- a/SCons/Node/FSTests.py +++ b/SCons/Node/FSTests.py @@ -32,7 +32,7 @@ import unittest import shutil import stat -from TestCmd import TestCmd +from TestCmd import TestCmd, IS_WINDOWS import TestUnit import SCons.Errors @@ -3541,57 +3541,64 @@ class prepareTestCase(unittest.TestCase): dir = fs.Dir("dir") dir.prepare() +# @unittest.skipIf(IS_WINDOWS, "No symlinks on windows") +# @unittest.skipUnless(hasattr(os, 'symlink'), "Platform doesn't support symlink") +class CleanSymlinksTestCase(_tempdirTestCase): -if sys.platform != 'win32' and hasattr(os, 'symlink'): - class CleanSymlinksTestCase(_tempdirTestCase): + def test_cleans_symlinks(self): + """Test the prepare() method will cleanup symlinks.""" - def test_cleans_symlinks(self): - """Test the prepare() method will cleanup symlinks.""" - with open("foo", "w") as foo: - foo.write("baz") + test = self.test - os.symlink("foo", "bar") - bar = self.fs.File("bar") - bar.side_effect = True - bar.set_state(0) - assert bar.exists() + with open(test.workpath("foo"), "w") as foo: + foo.write("baz") - bar.prepare() - try: - os.lstat("bar") - assert False, "bar should not exist" - except FileNotFoundError: - pass + os.symlink(test.workpath("foo"), test.workpath("bar")) + bar = self.fs.File(test.workpath("bar")) + bar.side_effect = True + bar.set_state(0) + assert bar.exists(), "Symlink %s should not exist after prepare"%str(bar) - os.stat("foo") + bar.prepare() + try: + os.lstat(test.workpath("bar")) + assert False, "bar should not exist" + except FileNotFoundError: + pass + try: + os.stat(test.workpath("foo")) + except FileNotFoundError: + test.fail('Real file %s should not be removed'%test.workpath('foo')) - def test_cleans_dangling_symlinks(self): - """Test the prepare() method will cleanup dangling symlinks.""" - with open("foo", "w") as foo: - foo.write("baz") + def test_cleans_dangling_symlinks(self): + """Test the prepare() method will cleanup dangling symlinks.""" + test = self.test - os.symlink("foo", "bar") - os.remove("foo") - try: - os.stat("foo") - assert False, "foo should not exist" - except FileNotFoundError: - pass + with open(test.workpath("foo"), "w") as foo: + foo.write("baz") - bar = self.fs.File("bar") - bar.side_effect = True - bar.set_state(0) + os.symlink(test.workpath("foo"), test.workpath("bar")) + os.remove(test.workpath("foo")) + try: + os.stat(test.workpath("foo")) + assert False, "foo should not exist" + except FileNotFoundError: + pass - # Dangling links should report not exists - assert not bar.exists() + bar = self.fs.File(test.workpath("bar")) + bar.side_effect = True + bar.set_state(0) - bar.prepare() - try: - os.lstat("bar") - assert False, "bar should not exist" - except FileNotFoundError: - pass + # Dangling links should report not exists + assert not bar.exists() + + bar.prepare() + try: + os.lstat(test.workpath("bar")) + assert False, "bar [%s] should not exist"%test.workpath("bar") + except FileNotFoundError: + pass class SConstruct_dirTestCase(unittest.TestCase): -- cgit v0.12 From 8825ac1211edb0ebdf3a098a0b962ee7ca5a4438 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 9 May 2020 20:22:59 -0700 Subject: [ci skip] Add bullet in RELEASE.txt --- RELEASE.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE.txt b/RELEASE.txt index 13548aa..843894b 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -47,6 +47,7 @@ FIXES + - Cleanup dangling symlinks before running builders (Issue #3516) - Fixed usage of abspath and path for RootDir objects on Windows. Previously env.fs.Dir("T:").abspath would return "T:\T:" and now it correctly returns "T:". - Fix Issue #3469 - Fixed improper reuse of temporary and compiled files by Configure when changing -- cgit v0.12