Skip to content
Snippets Groups Projects
Commit 2248fc54 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: do not import linkahead during build

parent aa250ad5
No related branches found
No related tags found
No related merge requests found
Pipeline #44874 failed
......@@ -4,6 +4,7 @@
#
"""linkahead"""
import os
import re
import subprocess
import sys
......@@ -96,6 +97,7 @@ def get_version_info():
FULLVERSION = VERSION
# Magic which is only really needed in the pipelines. Therefore: a lot of dark pipeline magic.
GIT_REVISION = "Unknown"
if os.path.exists('.git'):
GIT_REVISION = git_version()
elif os.path.exists('linkahead_pylib_commit'):
......@@ -103,14 +105,13 @@ def get_version_info():
GIT_REVISION = f.read().strip()
elif os.path.exists('src/linkahead/version.py'):
# must be a source distribution, use existing version file
try:
from linkahead.version import git_revision as GIT_REVISION
except ImportError:
raise ImportError("Unable to import git_revision. Try removing "
"src/linkahead/version.py and the build directory "
"before building.")
else:
GIT_REVISION = "Unknown"
with open('src/linkahead/version.py') as fi:
rev_pattern = re.compile(r"^git_revision = '(?P<rev>.*)'$")
for line in fi.readlines():
match = rev_pattern.match(line)
if match is not None:
GIT_REVISION = match.group('rev')
break
if not ISRELEASED:
FULLVERSION += '.dev0+' + GIT_REVISION[:7]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment