Use install_venv_common.py from oslo.
This syncs install_venv_common.py from oslo and reworks the tools/install_venv.py script to use the new library. Change-Id: I3426a7f51b0018e074cc6f4b1d70b38e52464a38
This commit is contained in:
@@ -258,6 +258,22 @@ def get_cmdclass():
|
|||||||
return cmdclass
|
return cmdclass
|
||||||
|
|
||||||
|
|
||||||
|
def _get_revno():
|
||||||
|
"""Return the number of commits since the most recent tag.
|
||||||
|
|
||||||
|
We use git-describe to find this out, but if there are no
|
||||||
|
tags then we fall back to counting commits since the beginning
|
||||||
|
of time.
|
||||||
|
"""
|
||||||
|
describe = _run_shell_command("git describe --always")
|
||||||
|
if "-" in describe:
|
||||||
|
return describe.rsplit("-", 2)[-2]
|
||||||
|
|
||||||
|
# no tags found
|
||||||
|
revlist = _run_shell_command("git rev-list --abbrev-commit HEAD")
|
||||||
|
return len(revlist.splitlines())
|
||||||
|
|
||||||
|
|
||||||
def get_version_from_git(pre_version):
|
def get_version_from_git(pre_version):
|
||||||
"""Return a version which is equal to the tag that's on the current
|
"""Return a version which is equal to the tag that's on the current
|
||||||
revision if there is one, or tag plus number of additional revisions
|
revision if there is one, or tag plus number of additional revisions
|
||||||
@@ -271,9 +287,7 @@ def get_version_from_git(pre_version):
|
|||||||
throw_on_error=True).replace('-', '.')
|
throw_on_error=True).replace('-', '.')
|
||||||
except Exception:
|
except Exception:
|
||||||
sha = _run_shell_command("git log -n1 --pretty=format:%h")
|
sha = _run_shell_command("git log -n1 --pretty=format:%h")
|
||||||
describe = _run_shell_command("git describe --always")
|
return "%s.a%s.g%s" % (pre_version, _get_revno(), sha)
|
||||||
revno = describe.rsplit("-", 2)[-2]
|
|
||||||
return "%s.a%s.g%s" % (pre_version, revno, sha)
|
|
||||||
else:
|
else:
|
||||||
return _run_shell_command(
|
return _run_shell_command(
|
||||||
"git describe --always").replace('-', '.')
|
"git describe --always").replace('-', '.')
|
||||||
|
|||||||
Reference in New Issue
Block a user