Skip to content
Snippets Groups Projects
Commit 439d6105 authored by Markus Holzer's avatar Markus Holzer Committed by Michael Kuron
Browse files

Fix installation from git

parent 296e1464
Branches
Tags
No related merge requests found
...@@ -18,17 +18,20 @@ def version_number_from_git(tag_prefix='release/', sha_length=10, version_format ...@@ -18,17 +18,20 @@ def version_number_from_git(tag_prefix='release/', sha_length=10, version_format
version_strings = get_released_versions() version_strings = get_released_versions()
version_strings.sort(key=StrictVersion) version_strings.sort(key=StrictVersion)
latest_release = version_strings[-1] if len(version_strings) > 0:
commits_since_tag = subprocess.getoutput('git rev-list {}..HEAD --count'.format(tag_from_version(latest_release))) latest_release = version_strings[-1]
sha = subprocess.getoutput('git rev-parse HEAD')[:sha_length] commits_since_tag = subprocess.getoutput('git rev-list {}..HEAD --count'.format(tag_from_version(latest_release)))
is_dirty = len(subprocess.getoutput("git status --untracked-files=no -s")) > 0 sha = subprocess.getoutput('git rev-parse HEAD')[:sha_length]
is_dirty = len(subprocess.getoutput("git status --untracked-files=no -s")) > 0
if int(commits_since_tag) == 0: if int(commits_since_tag) == 0:
version_string = latest_release version_string = latest_release
else: else:
next_version = increment_version(latest_release) next_version = increment_version(latest_release)
version_string = version_format.format(version=next_version, commits=commits_since_tag, sha=sha) version_string = version_format.format(version=next_version, commits=commits_since_tag, sha=sha)
if is_dirty: if is_dirty:
version_string += ".dirty" version_string += ".dirty"
return version_string return version_string
else:
return "development"
...@@ -59,12 +59,18 @@ def readme(): ...@@ -59,12 +59,18 @@ def readme():
def cython_extensions(*extensions): def cython_extensions(*extensions):
from distutils.extension import Extension from distutils.extension import Extension
ext = '.pyx' if USE_CYTHON else '.c'
result = [Extension(e, [e.replace('.', '/') + ext]) for e in extensions]
if USE_CYTHON: if USE_CYTHON:
ext = '.pyx'
result = [Extension(e, [os.path.join(*e.split(".")) + ext]) for e in extensions]
from Cython.Build import cythonize from Cython.Build import cythonize
result = cythonize(result, language_level=3) result = cythonize(result, language_level=3)
return result return result
elif all([os.path.exists(os.path.join(*e.split(".")) + '.c') for e in extensions]):
ext = '.c'
result = [Extension(e, [os.path.join(*e.split(".")) + ext]) for e in extensions]
return result
else:
return None
try: try:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment