diff options
author | Steven Knight <knight@baldmt.com> | 2002-12-05 03:37:58 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-12-05 03:37:58 (GMT) |
commit | 2e49581b613cd875ae114ba137e28512693605d8 (patch) | |
tree | 22b0a30687c74be39cd4b802282363163854c10e /src | |
parent | 1974e3b981c83ab735d03798d4bf77906097d7fc (diff) | |
download | SCons-2e49581b613cd875ae114ba137e28512693605d8.zip SCons-2e49581b613cd875ae114ba137e28512693605d8.tar.gz SCons-2e49581b613cd875ae114ba137e28512693605d8.tar.bz2 |
Prevent -n from unlinking files.
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 3 | ||||
-rw-r--r-- | src/engine/SCons/Node/FS.py | 10 | ||||
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c3b9d86..a97caaa 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -70,6 +70,9 @@ RELEASE 0.09 - flavors) to help people who want to ship SCons as a stand-alone build tool in their software packages. + - Prevent SCons from unlinking files in certain situations when + the -n option is used. + From Steven Knight and Anthony Roach: - Man page: document the fact that Builder calls return Node objects. diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 9976ef2..a3ac7be 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -46,6 +46,8 @@ import sys import SCons.Errors import SCons.Warnings +execute_actions = 1 + try: import os _link = os.link @@ -834,6 +836,8 @@ class File(Entry): if isinstance(p, ParentOfRoot): raise SCons.Errors.StopError, parent.path parent = p + if not execute_actions: + return listDirs.reverse() for dirnode in listDirs: try: @@ -861,7 +865,8 @@ class File(Entry): if self.exists(): if self.builder and not self.precious: - os.unlink(self.path) + if execute_actions: + os.unlink(self.path) if hasattr(self, '_exists'): delattr(self, '_exists') else: @@ -909,7 +914,8 @@ class File(Entry): if self._local: # ...and they'd like a local copy. print "Local copy of %s from %s" % (self.path, r.path) - file_link(r.path, self.path) + if execute_actions: + file_link(r.path, self.path) self.set_bsig(bsig) self.store_bsig() return 1 diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 57d0eeb..338b98f 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -641,6 +641,7 @@ def _main(): _setup_warn(options.warn) if options.noexec: SCons.Action.execute_actions = None + SCons.Node.FS.execute_actions = None CleanTask.execute = CleanTask.show if options.no_progress or options.silent: global display |