diff --git a/tests/apis/wscript b/tests/apis/wscript index 91d7998d..57135132 100755 --- a/tests/apis/wscript +++ b/tests/apis/wscript @@ -148,7 +148,7 @@ def test(ctx): tt("ant_glob ->", len(bld.srcnode.ant_glob('*.txt', flat=False)), 2) tt("ant_glob (icase) ->", len(bld.srcnode.ant_glob('*.txt', flat=False, ignorecase=True)), 3) - tt("ant_glob (special) ->", len(bld.srcnode.ant_glob('e.e+(e).txt', flat=False)), 1) + tt("ant_glob (parentheses) ->", len(bld.srcnode.ant_glob('e.e+[(]e[)].txt', flat=False)), 1) #print("ant_glob src ->", bld.srcnode.ant_glob('*.txt')) def abspath(self): diff --git a/waflib/Node.py b/waflib/Node.py index a94736c8..2ad18466 100644 --- a/waflib/Node.py +++ b/waflib/Node.py @@ -73,7 +73,7 @@ def ant_matcher(s, ignorecase): if k == '**': accu.append(k) else: - k = k.replace('.', '[.]').replace('*','.*').replace('?', '.').replace('+', '\\+').replace('(', '\\(').replace(')', '\\)') + k = k.replace('.', '[.]').replace('*', '.*').replace('?', '.').replace('+', '\\+') k = '^%s$' % k try: exp = re.compile(k, flags=reflags) diff --git a/waflib/extras/msvcdeps.py b/waflib/extras/msvcdeps.py index 54de25d3..873a4193 100644 --- a/waflib/extras/msvcdeps.py +++ b/waflib/extras/msvcdeps.py @@ -63,6 +63,9 @@ def path_to_node(base_node, path, cached_nodes): # normalize the path case to increase likelihood of a cache hit path = os.path.normcase(path) + # ant_glob interprets [] and () characters, so those must be replaced + path = path.replace('[', '?').replace(']', '?').replace('(', '[(]').replace(')', '[)]') + node_lookup_key = (base_node, path) try: @@ -73,7 +76,7 @@ def path_to_node(base_node, path, cached_nodes): try: node = cached_nodes[node_lookup_key] except KeyError: - node_list = base_node.ant_glob([path], ignorecase=True, remove=False, quiet=True) + node_list = base_node.ant_glob([path], ignorecase=True, remove=False, quiet=True, regex=False) node = cached_nodes[node_lookup_key] = node_list[0] if node_list else None return node