Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit d2a0776

Browse files
authored
adding version.txt file (#1293)
1 parent ccebe7c commit d2a0776

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

setup.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ def read(*names, **kwargs):
1818

1919

2020
def _get_version():
21-
version = '0.10.0a0'
22-
sha = None
23-
2421
try:
2522
cmd = ['git', 'rev-parse', 'HEAD']
2623
sha = subprocess.check_output(cmd, cwd=str(ROOT_DIR)).decode('ascii').strip()
2724
except Exception:
28-
pass
29-
30-
if os.getenv('BUILD_VERSION'):
31-
version = os.getenv('BUILD_VERSION')
32-
elif sha is not None:
33-
version += '+' + sha[:7]
25+
sha = None
26+
27+
if 'BUILD_VERSION' in os.environ:
28+
version = os.environ['BUILD_VERSION']
29+
else:
30+
with open(os.path.join(ROOT_DIR, 'version.txt'), 'r') as f:
31+
version = f.readline().strip()
32+
if sha is not None:
33+
version += '+' + sha[:7]
3434

3535
if sha is None:
3636
sha = 'Unknown'

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.10.0a0

0 commit comments

Comments
 (0)