mirror of https://gitlab.com/ita1024/waf.git
Undo parentheses escaping in ant_glob
This commit is contained in:
parent
89146d9030
commit
8cbc8da5ce
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue