diff options
author | William Deegan <bill@baddogconsulting.com> | 2018-01-05 20:40:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-05 20:40:44 (GMT) |
commit | 87bfc9191104693bc2fb1a74971eb2014f96e256 (patch) | |
tree | d1ac77219834117edd2bfd6d7c05fdecfd2269c6 | |
parent | 91d11918ad131c816dd481b82ca90b6aa15dc56b (diff) | |
parent | 25887d95760e9e4ac65f8bbde3a99a0b3a1d471a (diff) | |
download | SCons-87bfc9191104693bc2fb1a74971eb2014f96e256.zip SCons-87bfc9191104693bc2fb1a74971eb2014f96e256.tar.gz SCons-87bfc9191104693bc2fb1a74971eb2014f96e256.tar.bz2 |
Merge pull request #3044 from garyo/master
Fix problem with Install and multiple dirs outside src tree.
-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 |