diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -25,6 +25,45 @@ from sphinx.setup_command import BuildDoc from nova.utils import parse_mailmap, str_dict_replace +NOVA_VERSION = ['2011', '1'] + +VERSIONFILE_DEFAULT_VCS_VERSION = """ +version_info = {"branch_nick": "LOCALBRANCH", "revision_id": "LOCALREVISION"} +""" + +VERSIONFILE_DATA = """ +# below this line automatically generated by setup.py + +YEAR = %r +COUNT = %r +""" % (NOVA_VERSION[0], NOVA_VERSION[1]) + + +VERSIONFILE_DATA += """ + +def string(): + return '.'.join([YEAR, COUNT]) + + +def vcs_version_string(): + return "%s:%s" % (version_info['branch_nick'], version_info['revision_id']) + + +def string_with_vcs(): + return "%s-%s" % (string(), vcs_version_string()) +""" + +with open("nova/version.py", 'w') as version_file: + if os.path.isdir('.bzr'): + vcs_cmd = subprocess.Popen(["bzr", "version-info", "--python"], + stdout=subprocess.PIPE) + vcsversion = vcs_cmd.communicate()[0] + version_file.write(vcsversion) + else: + version_file.write(VERSIONFILE_DEFAULT_VCS_VERSION) + version_file.write(VERSIONFILE_DATA) + + class local_BuildDoc(BuildDoc): def run(self): for builder in ['html', 'man']: |