mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
fix setup.py when .git is not available
This commit is contained in:
parent
248a4da99d
commit
0670c15813
1 changed files with 6 additions and 3 deletions
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__)))
|
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()
|
||||||
|
try:
|
||||||
GIT_HEAD = open(os.path.join(script_dir, '.git', 'HEAD'), 'r').read().strip().split(': ')[1]
|
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]
|
GIT_SHA = open(os.path.join(script_dir, '.git', GIT_HEAD), 'r').read().strip()[:9]
|
||||||
PYPI_VERSION = "{}+{}".format(VERSION, GIT_SHA)
|
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue