diff options
author | James Falcon <james.falcon@canonical.com> | 2022-11-21 14:13:14 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-21 13:13:14 -0700 |
commit | 47174014c09e454b452c234a118756e981f95a01 (patch) | |
tree | cabefafcc8068aae6e9cf2af0f51228cc73d93bc /setup.py | |
parent | 5c1bd34e36dbce6b378e8c59d8bd105e285ddb33 (diff) | |
download | cloud-init-git-47174014c09e454b452c234a118756e981f95a01.tar.gz |
Update read-version
Use 'git describe <branch>' as the version number, even if the version
differs from what is in version.py. This means that if the most recent
commit is a tag, we'll get the tag number, otherwise we'll also show
the number of commits since the last tag on the branch.
Fix setup.py to align with PEP 440 versioning replacing trailing
hyphen beyond major.minor.patch-g<HASH> with a "+".
Additionally, did some cleanup and typing fixes on the script.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -73,7 +73,13 @@ def in_virtualenv(): def get_version(): cmd = [sys.executable, "tools/read-version"] ver = subprocess.check_output(cmd) - return ver.decode("utf-8").strip() + version = ver.decode("utf-8").strip() + # read-version can spit out something like 22.4-15-g7f97aee24 + # which is invalid under PEP440. If we replace the first - with a + + # that should give us a valid version. + if "-" in version: + version = version.replace("-", "+", 1) + return version def read_requires(): |