Skip to content

Instantly share code, notes, and snippets.

@cwvh
Created December 19, 2011 01:55
Show Gist options
  • Save cwvh/1495096 to your computer and use it in GitHub Desktop.
Save cwvh/1495096 to your computer and use it in GitHub Desktop.
stash
@pattern(r'^([a-zA-Z_\$\%][a-zA-Z_0-9\{\}]*)\s*:(?<=:)(?::([a-zA-Z_\$][a-zA-Z_0-9\{\}]*)?:)?\s*(.*)$')
def target(match, env=env):
labels = ('name', 'dep', 'components')
groups = dict(zip(labels, match.groups()))
for k, v in groups.iteritems():
groups[k] = env.interp(v) if v else v
name, dep = groups['name'], groups['dep']
components = re.findall('\w+', groups['components'])
makefile.addtarget(name, dep, components)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment