Skip to content
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.

Commit

Permalink
hack in regex matching for extra special globs (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
jctanner authored Feb 4, 2020
1 parent 57cb56f commit 3340c42
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions update_nwo.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,22 @@ def _guess_collection(self, plugin_type=None, plugin_basename=None, plugin_relpa

# globs are FUN ...
if '*' in rule['matcher']:

mpaths = rule['matcher'].split('/')
zipped = list(itertools.zip_longest(mpaths, ppaths))
bad = [False for x in zipped if x[0] != x[1] and x[0] != '*']

if not bad:
matched_rules.append(rule)
continue

# globs are MORE FUN ...
if '*' in rule['matcher']:
if re.match(rule['matcher'], plugin_relpath):
matched_rules.append(rule)
continue


if len(matched_rules) == 1:
return (matched_rules[0]['namespace'], matched_rules[0]['name'], matched_rules[0])
elif len(matched_rules) > 1:
Expand Down

0 comments on commit 3340c42

Please sign in to comment.