Less code generation.
This commit is contained in:
parent
9b35abf294
commit
8b3925e4d4
@ -12,3 +12,4 @@ CA/openssl.cnf
|
||||
CA/serial*
|
||||
CA/newcerts/*.pem
|
||||
CA/private/cakey.pem
|
||||
nova/vcsversion.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.
|
||||
|
@ -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 = {}
|
||||
|
||||
file_revisions = {}
|
||||
FINAL = False # This becomes true at Release Candidate time
|
||||
|
||||
|
||||
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 string():
|
||||
def canonical_version_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())
|
||||
|
38
setup.py
38
setup.py
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user