diff --git a/setup.py b/setup.py index 95fffe4035..5db3388053 100644 --- a/setup.py +++ b/setup.py @@ -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' diff --git a/version.txt b/version.txt new file mode 100644 index 0000000000..7e4490fc70 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.10.0a0 \ No newline at end of file