diff options
author | Dirk Baechle <dl9obn@darc.de> | 2014-04-27 19:47:33 (GMT) |
---|---|---|
committer | Dirk Baechle <dl9obn@darc.de> | 2014-04-27 19:47:33 (GMT) |
commit | ab8fb9d71510defd160b850a1441d47ded9370d3 (patch) | |
tree | 193cd641aafaf2c883988febfe405e4ffff2c8f7 /src/engine/SCons/Script | |
parent | fac472aac964c9f8b1d9dabb0ca2073cde3c3689 (diff) | |
download | SCons-ab8fb9d71510defd160b850a1441d47ded9370d3.zip SCons-ab8fb9d71510defd160b850a1441d47ded9370d3.tar.gz SCons-ab8fb9d71510defd160b850a1441d47ded9370d3.tar.bz2 |
- fixed NoClean for multi-target builders
Diffstat (limited to 'src/engine/SCons/Script')
-rw-r--r-- | src/engine/SCons/Script/Main.py | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 93380fb..7abea3f 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -339,37 +339,41 @@ class CleanTask(SCons.Taskmaster.AlwaysTask): except (IOError, OSError), e: print "scons: Could not remove '%s':" % pathstr, e.strerror - def show(self): + def _get_files_to_clean(self): + result = [] target = self.targets[0] - if (target.has_builder() or target.side_effect) and not target.noclean: - for t in self.targets: - if not t.isdir(): - display("Removed " + str(t)) - if target in SCons.Environment.CleanTargets: - files = SCons.Environment.CleanTargets[target] - for f in files: - self.fs_delete(f.abspath, str(f), 0) + if target.has_builder() or target.side_effect: + result = [t for t in self.targets if not t.noclean] + return result - def remove(self): + def _clean_targets(self, remove): target = self.targets[0] - if (target.has_builder() or target.side_effect) and not target.noclean: - for t in self.targets: - try: - removed = t.remove() - except OSError, e: - # An OSError may indicate something like a permissions - # issue, an IOError would indicate something like - # the file not existing. In either case, print a - # message and keep going to try to remove as many - # targets aa possible. - print "scons: Could not remove '%s':" % str(t), e.strerror - else: - if removed: - display("Removed " + str(t)) if target in SCons.Environment.CleanTargets: files = SCons.Environment.CleanTargets[target] for f in files: - self.fs_delete(f.abspath, str(f)) + self.fs_delete(f.abspath, str(f), remove) + + def show(self): + for t in self._get_files_to_clean(): + if not t.isdir(): + display("Removed " + str(t)) + self._clean_targets(0) + + def remove(self): + for t in self._get_files_to_clean(): + try: + removed = t.remove() + except OSError, e: + # An OSError may indicate something like a permissions + # issue, an IOError would indicate something like + # the file not existing. In either case, print a + # message and keep going to try to remove as many + # targets aa possible. + print "scons: Could not remove '%s':" % str(t), e.strerror + else: + if removed: + display("Removed " + str(t)) + self._clean_targets(1) execute = remove |