Skip to content

Commit

Permalink
Remove overly complicated versionning system which is no longer compa…
Browse files Browse the repository at this point in the history
…tible with pip
  • Loading branch information
bennahugo committed Jan 19, 2024
1 parent 39d7d68 commit ac079be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
5 changes: 3 additions & 2 deletions hypercube/version.py
@@ -1,2 +1,3 @@
# Do not edit this file, pipeline versioning is governed by git tags
__version__="0.0.0"
import pkg_resources

__version__ = pkg_resources.get_distribution("hypercube").version
29 changes: 1 addition & 28 deletions setup.py
Expand Up @@ -23,40 +23,13 @@
import subprocess
from setuptools._vendor.packaging import version

def get_version():
# Versioning code here, based on
# http://blogs.nopcode.org/brainstorm/2013/05/20/pragmatic-python-versioning-via-setuptools-and-git-tags/

# Fetch version from git tags, and write to version.py.
# Also, when git is not available (PyPi package), use stored version.py.
version_py = os.path.join('hypercube', 'version.py')

try:
version_git = str(subprocess.check_output(['git', 'describe',
'--tags']).rstrip())
except:
with open(version_py, 'r') as fh:
version_git = str(open(version_py).read().strip().split('=')[-1].replace('"',''))

try:
version.parse(version_git)
except version.InvalidVersion:
version_git = "0.0.0" # valid dev version

version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"

with open(version_py, 'w') as fh:
fh.write(str(version_msg) + str(os.linesep) + "__version__=\"" +
str(version_git) +"\"")

return str(version_git)

def readme():
with open('README.md') as f:
return f.read()

setup(name='hypercube',
version=get_version(),
version='0.3.5',
description='Actually an n-orthotope.',
long_description=readme(),
url='http://github.com/ska-sa/hypercube',
Expand Down

0 comments on commit ac079be

Please sign in to comment.