diff options
author | Alexandre Feblot <devnull@localhost> | 2015-04-29 22:19:55 (GMT) |
---|---|---|
committer | Alexandre Feblot <devnull@localhost> | 2015-04-29 22:19:55 (GMT) |
commit | 96b03f5736c84dc01b9de3b19a108c1f7846c89d (patch) | |
tree | 82ffb939ef4eeef3fd9c7b67ed7e835258045404 /src/engine/SCons/Node/FS.py | |
parent | 24244d6a075c2158c7ccb19fdb15b94c338eea17 (diff) | |
download | SCons-96b03f5736c84dc01b9de3b19a108c1f7846c89d.zip SCons-96b03f5736c84dc01b9de3b19a108c1f7846c89d.tar.gz SCons-96b03f5736c84dc01b9de3b19a108c1f7846c89d.tar.bz2 |
Glob exclude parameter can now be a string or a list of strings
Diffstat (limited to 'src/engine/SCons/Node/FS.py')
-rw-r--r-- | src/engine/SCons/Node/FS.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 0156e27..eec4e42 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -2048,9 +2048,10 @@ class Dir(Base): The "strings" argument, when true, returns the matches as strings, not Nodes. The strings are path names relative to this directory. - The "exclude" argument, if not None, must be a list of patterns - following the same UNIX shell semantics. Elements matching a least - one pattern of this list will be excluded from the result. + The "exclude" argument, if not None, must be a pattern or a list + of patterns following the same UNIX shell semantics. + Elements matching a least one pattern of this list will be excluded + from the result. The underlying algorithm is adapted from the glob.glob() function in the Python library (but heavily modified), and uses fnmatch() @@ -2071,7 +2072,7 @@ class Dir(Base): r = [os.path.join(str(dir), x) for x in r] result.extend(r) if exclude: - result = filter(lambda x: not any(fnmatch.fnmatch(str(x), e) for e in exclude), result) + result = filter(lambda x: not any(fnmatch.fnmatch(str(x), e) for e in SCons.Util.flatten(exclude)), result) return sorted(result, key=lambda a: str(a)) def _glob1(self, pattern, ondisk=True, source=False, strings=False): |