mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-22 06:03:23 +02:00
fix setup.py when .git is not available
This commit is contained in:
3
setup.py
3
setup.py
@@ -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()
|
||||
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)
|
||||
|
Reference in New Issue
Block a user