Skip to content

Commit 959ca53

Browse files
ref: Remove logic for resolving version from tag; failover to v0.0.0 (#466)
## 📝 Description This change drops the logic that causes the CLI default to the latest annotated git tag, which causes installation issues when the repo is cloned directly from a branch or does not have the `.git` directory. If no version environment variable or baked file is defined, the version will now default to `v0.0.0`. ## ✔️ How to Test ``` make install ```
1 parent 1412238 commit 959ca53

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

version

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,15 @@ def get_version_env():
1919
def get_version(ref="HEAD"):
2020
# We want to override the version if an environment variable is specified.
2121
# This is useful for certain release and testing pipelines.
22-
describe = get_version_env()
23-
24-
if describe is None:
25-
describe = call('git describe {} --tags'.format(ref))
22+
version_str = get_version_env() or "0.0.0"
2623

2724
# Strip the `v` prefix if specified
28-
if describe.startswith("v"):
29-
describe = describe[1:]
25+
if version_str.startswith("v"):
26+
version_str = version_str[1:]
3027

31-
parts = LooseVersion(describe).version[:3]
28+
parts = LooseVersion(version_str).version[:3]
3229
return tuple(parts)
3330

3431

35-
def call(cmd):
36-
_, output = subprocess.getstatusoutput(cmd)
37-
return output
38-
39-
4032
major, minor, patch = get_version()
4133
print("{}.{}.{}".format(major, minor, patch))

0 commit comments

Comments
 (0)