Skip to content

Commit

Permalink
adding version.txt file (#1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
parmeet authored Apr 23, 2021
1 parent ccebe7c commit d2a0776
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ def read(*names, **kwargs):


def _get_version():
version = '0.10.0a0'
sha = None

try:
cmd = ['git', 'rev-parse', 'HEAD']
sha = subprocess.check_output(cmd, cwd=str(ROOT_DIR)).decode('ascii').strip()
except Exception:
pass

if os.getenv('BUILD_VERSION'):
version = os.getenv('BUILD_VERSION')
elif sha is not None:
version += '+' + sha[:7]
sha = None

if 'BUILD_VERSION' in os.environ:
version = os.environ['BUILD_VERSION']
else:
with open(os.path.join(ROOT_DIR, 'version.txt'), 'r') as f:
version = f.readline().strip()
if sha is not None:
version += '+' + sha[:7]

if sha is None:
sha = 'Unknown'
Expand Down
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.10.0a0

0 comments on commit d2a0776

Please sign in to comment.