mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-22 14:13:01 +02:00
fix setup.py when .git is not available
This commit is contained in:
9
setup.py
9
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__)))
|
script_dir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
VERSION = open(os.path.join(script_dir, 'VERSION'), 'r').read().strip()
|
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]
|
try:
|
||||||
GIT_SHA = open(os.path.join(script_dir, '.git', GIT_HEAD), 'r').read().strip()[:9]
|
GIT_HEAD = open(os.path.join(script_dir, '.git', 'HEAD'), 'r').read().strip().split(': ')[1]
|
||||||
PYPI_VERSION = "{}+{}".format(VERSION, GIT_SHA)
|
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:
|
with open(os.path.join(script_dir, 'archivebox', 'VERSION'), 'w+') as f:
|
||||||
f.write(PYPI_VERSION)
|
f.write(PYPI_VERSION)
|
||||||
|
Reference in New Issue
Block a user