Skip to content

Commit c6bc90b

Browse files
committed
Merge pull request #70 from mdavidsaver/py-hook
(closes #70)
2 parents af1ecba + 91fb22b commit c6bc90b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cue.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,21 @@ def add_dependency(dep):
611611
if dep + '_HOOK' in setup:
612612
hook = setup[dep + '_HOOK']
613613
hook_file = os.path.join(curdir, hook)
614+
hook_ext = os.path.splitext(hook_file)[1]
614615
if os.path.exists(hook_file):
615-
if re.match(r'.+\.patch$', hook):
616+
if hook_ext == '.patch':
616617
apply_patch(hook_file, cwd=place)
617-
elif re.match(r'.+\.(zip|7z)$', hook):
618+
elif hook_ext in ('.zip', '.7z'):
618619
extract_archive(hook_file, cwd=place)
620+
elif hook_ext == '.py':
621+
print('Running py hook {0} in {1}'.format(hook, place))
622+
sp.check_call([sys.executable, hook_file], cwd=place)
619623
else:
620624
print('Running hook {0} in {1}'.format(hook, place))
621625
sys.stdout.flush()
622626
sp.check_call(hook_file, shell=True, cwd=place)
627+
else:
628+
print('Skipping invalid hook {0} in {1}'.format(hook, place))
623629

624630
# write checked out commit hash to marker file
625631
head = get_git_hash(place)

0 commit comments

Comments
 (0)