diff options
author | Gary Oberbrunner <garyo@genarts.com> | 2018-01-05 19:03:31 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@genarts.com> | 2018-01-05 19:12:39 (GMT) |
commit | 25887d95760e9e4ac65f8bbde3a99a0b3a1d471a (patch) | |
tree | d1ac77219834117edd2bfd6d7c05fdecfd2269c6 | |
parent | 91d11918ad131c816dd481b82ca90b6aa15dc56b (diff) | |
download | SCons-25887d95760e9e4ac65f8bbde3a99a0b3a1d471a.zip SCons-25887d95760e9e4ac65f8bbde3a99a0b3a1d471a.tar.gz SCons-25887d95760e9e4ac65f8bbde3a99a0b3a1d471a.tar.bz2 |
Fix problem with Install and multiple dirs outside src tree.
In some cases it's possible to get a case where the target
path already does exist, but the dir node for it hasn't been
updated yet. This fix prevents MkdirFunc from trying to create
it when it already exists. Added a testcase which failed before
the fix and works after it.
Also fixes a problem running tests on Windows, using standard
python 3 which is installed in "C:/Program Files/Python36".
The python path name has to be escaped in that case. See runtest.py.
-rwxr-xr-x | runtest.py | 2 | ||||
-rw-r--r-- | src/CHANGES.txt | 7 | ||||
-rw-r--r-- | src/engine/SCons/Node/FS.py | 7 | ||||
-rw-r--r-- | test/Install/multi-dir.py | 41 | ||||
-rw-r--r-- | test/Install/multi-dir/src/SConstruct | 8 | ||||
-rw-r--r-- | test/Install/multi-dir/src/a/b/abfile | 0 | ||||
-rw-r--r-- | test/Install/multi-dir/src/x/y/xyfile | 0 |
7 files changed, 61 insertions, 4 deletions
@@ -799,7 +799,7 @@ def run_test(t, io_lock, async=True): if options.runner and t.path in unittests: # For example --runner TestUnit.TAPTestRunner command_args.append('--runner ' + options.runner) - t.command_args = [python] + command_args + t.command_args = [escape(python)] + command_args t.command_str = " ".join([escape(python)] + command_args) if printcommand: if print_progress: diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 3ccb8a1..0028524 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -7,11 +7,14 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Gary Oberbrunner: + - Fix bug when Installing multiple subdirs outside the source tree + From Mats Wichmann: - Updated manpage scons.xml to fix a nested list problem - + From Andrew Featherstone - - Removed unused --warn options from the man page and source code. + - Removed unused --warn options from the man page and source code. From Daniel Moody: - Updated Jar builder to handle nodes and directories better diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 684f0d1..9a48432 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -328,7 +328,12 @@ Unlink = SCons.Action.Action(UnlinkFunc, None) def MkdirFunc(target, source, env): t = target[0] - if not t.exists(): + # This os.path.exists test looks redundant, but it's possible + # when using Install() to install multiple dirs outside the + # source tree to get a case where t.exists() is true but + # the path does already exist, so this prevents spurious + # build failures in that case. See test/Install/multi-dir. + if not t.exists() and not os.path.exists(t.get_abspath()): t.fs.mkdir(t.get_abspath()) return 0 diff --git a/test/Install/multi-dir.py b/test/Install/multi-dir.py new file mode 100644 index 0000000..ddb6d0a --- /dev/null +++ b/test/Install/multi-dir.py @@ -0,0 +1,41 @@ +#!/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__" + +""" +Verify that using Install to create multiple dir hierarchies outside +the source tree works. +""" + +import TestSCons +# _python_ = TestSCons._python_ + +test = TestSCons.TestSCons() +test.dir_fixture('multi-dir') +# Expect failure if bug exists, success if it's fixed +test.run(arguments="-C src ..") +test.must_exist('build/__foo/bar/baz/a/b/abfile') +test.must_exist('build/__foo/bar/baz/a/b/y/xyfile') +test.pass_test() diff --git a/test/Install/multi-dir/src/SConstruct b/test/Install/multi-dir/src/SConstruct new file mode 100644 index 0000000..e10ec8d --- /dev/null +++ b/test/Install/multi-dir/src/SConstruct @@ -0,0 +1,8 @@ +# This tests for a bug where installing a sequence dirs and subdirs +# outside the source tree can cause SCons to fail to create the dest +# dir. +import os, os.path, shutil +env=Environment() +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-dir/src/a/b/abfile b/test/Install/multi-dir/src/a/b/abfile new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Install/multi-dir/src/a/b/abfile diff --git a/test/Install/multi-dir/src/x/y/xyfile b/test/Install/multi-dir/src/x/y/xyfile new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Install/multi-dir/src/x/y/xyfile |