summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-02-16 22:34:26 (GMT)
committerSteven Knight <knight@baldmt.com>2005-02-16 22:34:26 (GMT)
commit93acc2d810798fda05fcb463da6362baa8653fd7 (patch)
treea1a117bc563b5bfabf314ff70b448a090927ed6e /src/engine/SCons
parentd809676c50c89f74f3210d4faf61c3f66a600777 (diff)
downloadSCons-93acc2d810798fda05fcb463da6362baa8653fd7.zip
SCons-93acc2d810798fda05fcb463da6362baa8653fd7.tar.gz
SCons-93acc2d810798fda05fcb463da6362baa8653fd7.tar.bz2
Fix creating a build_dir from scratch when there's a subsidiary SConscript() file.
Diffstat (limited to 'src/engine/SCons')
-rw-r--r--src/engine/SCons/Node/FS.py58
-rw-r--r--src/engine/SCons/Script/SConscript.py4
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)