Base version.py on glance.
This makes setting and calculating the versioning of quantum more like other OpenStack projects, simplifying the work of the CI and Release Management teams. Addresses bug 916018 which prevents the quantum-tarball job from running correctly. Change-Id: I5b006ccc3d31c5d213c703853dfa38f04d983918
This commit is contained in:
parent
d5414390df
commit
b11971933a
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ run_tests.log
|
|||||||
tests/
|
tests/
|
||||||
.quantum-venv/
|
.quantum-venv/
|
||||||
.venv/
|
.venv/
|
||||||
|
quantum/vcsversion.py
|
||||||
|
30
setup.py
30
setup.py
@ -6,11 +6,37 @@ except ImportError:
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import version
|
import os
|
||||||
|
import subprocess
|
||||||
|
from quantum import version
|
||||||
|
|
||||||
|
|
||||||
|
def run_git_command(cmd):
|
||||||
|
output = subprocess.Popen(["/bin/sh", "-c", cmd],
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
return output.communicate()[0].strip()
|
||||||
|
|
||||||
|
|
||||||
|
if os.path.isdir('.git'):
|
||||||
|
branch_nick_cmd = 'git branch | grep -Ei "\* (.*)" | cut -f2 -d" "'
|
||||||
|
branch_nick = run_git_command(branch_nick_cmd)
|
||||||
|
revid_cmd = "git --no-pager log --max-count=1 | cut -f2 -d' ' | head -1"
|
||||||
|
revid = run_git_command(revid_cmd)
|
||||||
|
revno_cmd = "git --no-pager log --oneline | wc -l"
|
||||||
|
revno = run_git_command(revno_cmd)
|
||||||
|
with open("quantum/vcsversion.py", 'w') as version_file:
|
||||||
|
version_file.write("""
|
||||||
|
# This file is automatically generated by setup.py, So don't edit it. :)
|
||||||
|
version_info = {
|
||||||
|
'branch_nick': '%s',
|
||||||
|
'revision_id': '%s',
|
||||||
|
'revno': %s
|
||||||
|
}
|
||||||
|
""" % (branch_nick, revid, revno))
|
||||||
|
|
||||||
Name = 'quantum'
|
Name = 'quantum'
|
||||||
Url = "https://launchpad.net/quantum"
|
Url = "https://launchpad.net/quantum"
|
||||||
Version = version.get_git_version()
|
Version = version.canonical_version_string()
|
||||||
License = 'Apache License 2.0'
|
License = 'Apache License 2.0'
|
||||||
Author = 'Netstack'
|
Author = 'Netstack'
|
||||||
AuthorEmail = 'netstack@lists.launchpad.net'
|
AuthorEmail = 'netstack@lists.launchpad.net'
|
||||||
|
Loading…
Reference in New Issue
Block a user