mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 03:01:57 +02:00
Deal with .git being a file when getting the VCS commit hash during building
This commit is contained in:
12
setup.py
12
setup.py
@@ -308,9 +308,15 @@ def get_vcs_rev_defines():
|
|||||||
try:
|
try:
|
||||||
rev = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip()
|
rev = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
with open('.git/refs/heads/master') as f:
|
try:
|
||||||
rev = f.read()
|
with open('.git/refs/heads/master') as f:
|
||||||
ans.append('KITTY_VCS_REV="{}"'.format(rev))
|
rev = f.read()
|
||||||
|
except NotADirectoryError:
|
||||||
|
gitloc = open('.git').read()
|
||||||
|
with open(os.path.join(gitloc, '/refs/heads/master')) as f:
|
||||||
|
rev = f.read()
|
||||||
|
|
||||||
|
ans.append('KITTY_VCS_REV="{}"'.format(rev.strip()))
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user