|
32 | 32 |
|
33 | 33 | import copy
|
34 | 34 | import os
|
35 |
| -import sys |
36 | 35 | import re
|
37 | 36 | import shlex
|
| 37 | +import sys |
38 | 38 | from collections import UserDict
|
39 | 39 |
|
40 | 40 | import SCons.Action
|
41 | 41 | import SCons.Builder
|
42 | 42 | import SCons.Debug
|
43 |
| -from SCons.Debug import logInstanceCreation |
44 | 43 | import SCons.Defaults
|
45 |
| -from SCons.Errors import UserError, BuildError |
46 | 44 | import SCons.Memoize
|
47 | 45 | import SCons.Node
|
48 | 46 | import SCons.Node.Alias
|
|
54 | 52 | import SCons.Subst
|
55 | 53 | import SCons.Tool
|
56 | 54 | import SCons.Warnings
|
| 55 | +from SCons.Debug import logInstanceCreation |
| 56 | +from SCons.Errors import UserError, BuildError |
57 | 57 | from SCons.Util import (
|
58 | 58 | AppendPath,
|
59 | 59 | CLVar,
|
|
74 | 74 | uniquer_hashables,
|
75 | 75 | )
|
76 | 76 |
|
| 77 | + |
77 | 78 | class _Null:
|
78 | 79 | pass
|
79 | 80 |
|
@@ -2000,6 +2001,17 @@ def CacheDir(self, path):
|
2000 | 2001 |
|
2001 | 2002 | def Clean(self, targets, files):
|
2002 | 2003 | global CleanTargets
|
| 2004 | + |
| 2005 | + # Check for anything which evaluates to empty string, which would yield cleaning '.' |
| 2006 | + targets_strings = [(t, self.subst(t)) for t in flatten(targets) if is_String(t) and ('$' in t or t == '')] |
| 2007 | + files_strings = [(t, self.subst(t)) for t in flatten(files) if is_String(t) and ('$' in t or t == '')] |
| 2008 | + if any([s=='' for t,s in targets_strings]): |
| 2009 | + raise UserError("Targets specified to Clean() include on which evaluates to an empty string: [%s]" % ",".join( |
| 2010 | + ["%s='%s'"%(str(t),s) for (t, s) in targets_strings])) |
| 2011 | + if any([s=='' for t,s in files_strings]): |
| 2012 | + raise UserError("Targets specified to Clean() include on which evaluates to an empty string: [%s]" % ",".join( |
| 2013 | + ["%s='%s'"%(str(t),s) for (t, s) in files_strings])) |
| 2014 | + |
2003 | 2015 | tlist = self.arg2nodes(targets, self.fs.Entry)
|
2004 | 2016 | flist = self.arg2nodes(files, self.fs.Entry)
|
2005 | 2017 | for t in tlist:
|
|
0 commit comments