diff options
author | Mats Wichmann <mats@linux.com> | 2021-07-24 15:00:37 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2021-07-24 17:41:57 (GMT) |
commit | b490263907d447152b6cf9b94f8026299a45b72c (patch) | |
tree | 6fa0f178050139cb555529e9f1040a6ff2320050 /SCons/Scanner | |
parent | 9a9a5964e06d231e328bd1550f4b3ec19344970d (diff) | |
download | SCons-b490263907d447152b6cf9b94f8026299a45b72c.zip SCons-b490263907d447152b6cf9b94f8026299a45b72c.tar.gz SCons-b490263907d447152b6cf9b94f8026299a45b72c.tar.bz2 |
Restore original behavior in Base.__call__
A previous commit changed some of the existing logic incorrectly.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/Scanner')
-rw-r--r-- | SCons/Scanner/__init__.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/SCons/Scanner/__init__.py b/SCons/Scanner/__init__.py index 983bc8f..3016f40 100644 --- a/SCons/Scanner/__init__.py +++ b/SCons/Scanner/__init__.py @@ -221,16 +221,13 @@ class Base: else: node_list = self.function(node, env, path) - if self.node_class: - kw = {} - if hasattr(node, 'dir'): - kw['directory'] = node.dir - conv = env.get_factory(self.node_factory) - cls = self.node_class - nl = [n if isinstance(n, cls) else conv(n, **kw) for n in node_list] - return nl - - return node_list + kw = {} + if hasattr(node, 'dir'): + kw['directory'] = node.dir + conv = env.get_factory(self.node_factory) + cls = self.node_class + nl = [conv(n, **kw) if cls and not isinstance(n, cls) else n for n in node_list] + return nl def __eq__(self, other): try: @@ -337,7 +334,6 @@ class Classic(Current): """ def __init__(self, name, suffixes, path_variable, regex, *args, **kwargs): - self.cre = re.compile(regex, re.M) def _scan(node, _, path=(), self=self): @@ -372,7 +368,6 @@ class Classic(Current): return self.cre.findall(node.get_text_contents()) def scan(self, node, path=()): - # cache the includes list in node so we only scan it once: if node.includes is not None: includes = node.includes |