diff options
author | Soren Hansen <soren@linux2go.dk> | 2011-01-07 15:17:03 +0100 |
---|---|---|
committer | Soren Hansen <soren@linux2go.dk> | 2011-01-07 15:17:03 +0100 |
commit | 8b3925e4d4b97dc28bfc903483ec4793fb38fed5 (patch) | |
tree | 06230d55ca5cbbaf6bf38e809e7fd63c3c463b1b | |
parent | 9b35abf29438600ff8a8a91226000e7ea11ca534 (diff) | |
download | nova-8b3925e4d4b97dc28bfc903483ec4793fb38fed5.tar.gz nova-8b3925e4d4b97dc28bfc903483ec4793fb38fed5.tar.xz nova-8b3925e4d4b97dc28bfc903483ec4793fb38fed5.zip |
Less code generation.
-rw-r--r-- | .bzrignore | 1 | ||||
-rw-r--r-- | doc/source/conf.py | 5 | ||||
-rw-r--r-- | nova/version.py | 40 | ||||
-rw-r--r-- | setup.py | 38 |
4 files changed, 25 insertions, 59 deletions
diff --git a/.bzrignore b/.bzrignore index d81a7d829..b271561a3 100644 --- a/.bzrignore +++ b/.bzrignore @@ -12,3 +12,4 @@ CA/openssl.cnf CA/serial* CA/newcerts/*.pem CA/private/cakey.pem +nova/vcsversion.py diff --git a/doc/source/conf.py b/doc/source/conf.py index 61b3749d0..20e9c88af 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -60,12 +60,11 @@ copyright = u'2010, United States Government as represented by the Administrator # |version| and |release|, also used in various other places throughout the # built documents. # -import re from nova import version as nova_version # The full version, including alpha/beta/rc tags. -release = nova_version.string() +release = nova_version.version() # The short X.Y version. -version = re.sub(r'-dev$', '', nova_version.string()) +version = nova_version.canonical_version() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/nova/version.py b/nova/version.py index fc14b8401..1504a5c82 100644 --- a/nova/version.py +++ b/nova/version.py @@ -1,35 +1,31 @@ #!/usr/bin/env python -"""This file is automatically generated by generate_version_info -It uses the current working tree to determine the revision. -So don't edit it. :) -""" +try: + from nova.vcsversion import version_info +except ImportError: + version_info = {'branch_nick': u'LOCALBRANCH', + 'revision_id': 'LOCALREVISION', + 'revno': 0} -version_info = {'branch_nick': u'LOCALBRANCH', 'revision_id': 'LOCALREVISION', - 'revno': 0} +NOVA_VERSION = ['2011', '1'] +YEAR, COUNT = NOVA_VERSION -revisions = {} +FINAL = False # This becomes true at Release Candidate time -file_revisions = {} - -if __name__ == '__main__': - print 'revision: %(revno)d' % version_info - print 'nick: %(branch_nick)s' % version_info - print 'revision id: %(revision_id)s' % version_info - -# below this line automatically generated by setup.py - -YEAR = '2011' -COUNT = '1-dev' +def canonical_version_string(): + return '.'.join([YEAR, COUNT]) -def string(): - return '.'.join([YEAR, COUNT]) +def version_string(): + if FINAL: + return canonical_version_string() + else: + return '%s-dev' % (canonical_version_string(),) 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()) +def version_string_with_vcs(): + return "%s-%s" % (canonical_version_string(), vcs_version_string()) @@ -24,44 +24,14 @@ from setuptools.command.sdist import sdist from sphinx.setup_command import BuildDoc from nova.utils import parse_mailmap, str_dict_replace +from nova import version -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'): +if os.path.isdir('.bzr'): + with open("nova/vcsversion.py", 'w') as version_file: 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): @@ -88,7 +58,7 @@ class local_sdist(sdist): sdist.run(self) setup(name='nova', - version='2011.1', + version=version.canonical_version(), description='cloud computing fabric controller', author='OpenStack', author_email='nova@lists.launchpad.net', |