diff options
author | Steven Knight <knight@baldmt.com> | 2005-02-16 22:34:26 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-02-16 22:34:26 (GMT) |
commit | 2456f7e895f4a8843bd8739c3de6214c68a88b0b (patch) | |
tree | a1a117bc563b5bfabf314ff70b448a090927ed6e /src | |
parent | 62cbc49e4a8cf1aec05e2a81ebce02aa48de01d0 (diff) | |
download | SCons-2456f7e895f4a8843bd8739c3de6214c68a88b0b.zip SCons-2456f7e895f4a8843bd8739c3de6214c68a88b0b.tar.gz SCons-2456f7e895f4a8843bd8739c3de6214c68a88b0b.tar.bz2 |
Fix creating a build_dir from scratch when there's a subsidiary SConscript() file.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Node/FS.py | 58 | ||||
-rw-r--r-- | src/engine/SCons/Script/SConscript.py | 4 |
2 files changed, 34 insertions, 28 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 2830a20..e7b283d 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1286,6 +1286,36 @@ class Dir(Base): if not self.builder is MkdirBuilder: apply(SCons.Node.Node.build, [self,], kw) + def _create(self): + """Create this directory, silently and without worrying about + whether the builder is the default or not.""" + listDirs = [] + parent = self + while parent: + if parent.exists(): + break + listDirs.append(parent) + p = parent.up() + if isinstance(p, ParentOfRoot): + raise SCons.Errors.StopError, parent.path + parent = p + listDirs.reverse() + for dirnode in listDirs: + try: + # Don't call dirnode.build(), call the base Node method + # directly because we definitely *must* create this + # directory. The dirnode.build() method will suppress + # the build if it's the default builder. + SCons.Node.Node.build(dirnode) + dirnode.get_executor().nullify() + # The build() action may or may not have actually + # created the directory, depending on whether the -n + # option was used or not. Delete the _exists and + # _rexists attributes so they can be reevaluated. + dirnode.clear() + except OSError: + pass + def multiple_side_effect_has_builder(self): global MkdirBuilder return not self.builder is MkdirBuilder and self.has_builder() @@ -1542,33 +1572,7 @@ class File(Base): def _createDir(self): # ensure that the directories for this node are # created. - - listDirs = [] - parent=self.dir - while parent: - if parent.exists(): - break - listDirs.append(parent) - p = parent.up() - if isinstance(p, ParentOfRoot): - raise SCons.Errors.StopError, parent.path - parent = p - listDirs.reverse() - for dirnode in listDirs: - try: - # Don't call dirnode.build(), call the base Node method - # directly because we definitely *must* create this - # directory. The dirnode.build() method will suppress - # the build if it's the default builder. - SCons.Node.Node.build(dirnode) - dirnode.get_executor().nullify() - # The build() action may or may not have actually - # created the directory, depending on whether the -n - # option was used or not. Delete the _exists and - # _rexists attributes so they can be reevaluated. - dirnode.clear() - except OSError: - pass + self.dir._create() def retrieve_from_cache(self): """Try to retrieve the node's content from a cache diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index 2e8c916..d0df6a3 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -230,7 +230,9 @@ def _SConscript(fs, *files, **kw): # Repository directory. Like above, we do this # directly. fs.chdir(frame.prev_dir, change_os_dir=0) - os.chdir(frame.prev_dir.rdir().get_abspath()) + rdir = frame.prev_dir.rdir() + rdir._create() # Make sure there's a directory there. + os.chdir(rdir.get_abspath()) results.append(frame.retval) |