mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-02-12 03:05:30 +01:00
Fix python invocation in git hooks
This commit is contained in:
parent
d7828644f5
commit
cd7e8891bd
2 changed files with 6 additions and 5 deletions
|
|
@ -9,15 +9,19 @@
|
|||
import os, subprocess, sys
|
||||
|
||||
prev_rev, current_rev, flags = [x.decode('utf-8') if isinstance(x, bytes) else x for x in sys.argv[1:]]
|
||||
|
||||
|
||||
def get_branch_name(rev):
|
||||
return subprocess.check_output(['git', 'name-rev', '--name-only', rev]).decode('utf-8').strip()
|
||||
|
||||
|
||||
base = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
os.chdir(base)
|
||||
|
||||
if flags == '1': # A branch checkout
|
||||
prev_branch, cur_branch = map(get_branch_name, (prev_rev, current_rev))
|
||||
|
||||
subprocess.check_call(['python', 'setup.py', 'gui', '--summary'])
|
||||
subprocess.check_call([sys.executable, 'setup.py', 'gui', '--summary'])
|
||||
|
||||
# Remove .pyc files as some of them might have been orphaned
|
||||
for dirpath, dirnames, filenames in os.walk('.'):
|
||||
|
|
@ -25,4 +29,3 @@ def get_branch_name(rev):
|
|||
fpath = os.path.join(dirpath, f)
|
||||
if f.endswith('.pyc'):
|
||||
os.remove(fpath)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,4 @@
|
|||
action = [x.decode('utf-8') if isinstance(x, bytes) else x for x in sys.argv[1:]][0]
|
||||
|
||||
if action == 'rebase':
|
||||
subprocess.check_call(['python', 'setup.py', 'gui'])
|
||||
|
||||
|
||||
subprocess.check_call([sys.executable, 'setup.py', 'gui'])
|
||||
|
|
|
|||
Loading…
Reference in a new issue