summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2022-12-15 08:52:02 -0700
committerGitHub <noreply@github.com>2022-12-15 08:52:02 -0700
commit6bdd88a7f1d69dc4aac9fa51d663c4b11e3b5217 (patch)
tree8cdd721677aaa6e3204c779f0d2736549fd2d493
parent5f5c3e196d3cd4c6b491fa5ab76da141684a81dc (diff)
downloadcloud-init-git-6bdd88a7f1d69dc4aac9fa51d663c4b11e3b5217.tar.gz
read-version: When insufficient tags, use cloudinit.version.get_version
-rwxr-xr-xtools/read-version11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/read-version b/tools/read-version
index 50f91b5d..3a0561a3 100755
--- a/tools/read-version
+++ b/tools/read-version
@@ -90,7 +90,16 @@ if is_gitdir(_tdir) and which("git") and not is_release_branch_ci:
branch_name,
] + flags
- version = tiny_p(cmd).strip()
+ try:
+ version = tiny_p(cmd).strip()
+ version_long = tiny_p(cmd + ["--long"]).strip()
+ except subprocess.CalledProcessError as e:
+ if "No tags can describe" in e.stderr:
+ print(f"{cmd} found no tags. Using cloudinit.verison.py ")
+ version = src_version
+ version_long = ""
+ else:
+ raise
version_long = tiny_p(cmd + ["--long"]).strip()
else:
version = src_version