1
0
Fork 0
mirror of synced 2024-06-02 02:25:20 +12:00

fix setup.py when .git is not available

This commit is contained in:
Nick Sweeting 2019-04-27 17:49:54 -04:00
parent 248a4da99d
commit 0670c15813

View file

@ -8,9 +8,12 @@ with open("README.md", "r") as fh:
script_dir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
VERSION = open(os.path.join(script_dir, 'VERSION'), 'r').read().strip()
GIT_HEAD = open(os.path.join(script_dir, '.git', 'HEAD'), 'r').read().strip().split(': ')[1]
GIT_SHA = open(os.path.join(script_dir, '.git', GIT_HEAD), 'r').read().strip()[:9]
PYPI_VERSION = "{}+{}".format(VERSION, GIT_SHA)
try:
GIT_HEAD = open(os.path.join(script_dir, '.git', 'HEAD'), 'r').read().strip().split(': ')[1]
GIT_SHA = open(os.path.join(script_dir, '.git', GIT_HEAD), 'r').read().strip()[:9]
PYPI_VERSION = "{}+{}".format(VERSION, GIT_SHA)
except:
PYPI_VERSION = VERSION
with open(os.path.join(script_dir, 'archivebox', 'VERSION'), 'w+') as f:
f.write(PYPI_VERSION)