Merge version stuff
This commit is contained in:
commit
9b35abf294
@ -60,10 +60,12 @@ copyright = u'2010, United States Government as represented by the Administrator
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '2011.1'
|
||||
import re
|
||||
from nova import version as nova_version
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '2011.1-prerelease'
|
||||
release = nova_version.string()
|
||||
# The short X.Y version.
|
||||
version = re.sub(r'-dev$', '', nova_version.string())
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
15
nova/log.py
15
nova/log.py
@ -34,24 +34,19 @@ import logging.handlers
|
||||
import traceback
|
||||
|
||||
from nova import flags
|
||||
# TODO(todd): fix after version.py merge
|
||||
# from nova import version
|
||||
from nova import version
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
|
||||
# TODO(todd): fix after version.py merge
|
||||
# '(%(name)s %(nova_version)s): %(levelname)s '
|
||||
flags.DEFINE_string('logging_context_format_string',
|
||||
'(%(name)s): %(levelname)s '
|
||||
'(%(name)s %(nova_version)s): %(levelname)s '
|
||||
'[%(request_id)s %(user)s '
|
||||
'%(project)s] %(message)s',
|
||||
'format string to use for log messages')
|
||||
|
||||
# TODO(todd): fix after version.py merge
|
||||
# '(%(name)s %(nova_version)s): %(levelname)s [N/A] '
|
||||
flags.DEFINE_string('logging_default_format_string',
|
||||
'(%(name)s): %(levelname)s [N/A] '
|
||||
'(%(name)s %(nova_version)s): %(levelname)s [N/A] '
|
||||
'%(message)s',
|
||||
'format string to use for log messages')
|
||||
|
||||
@ -74,7 +69,6 @@ flags.DEFINE_bool('use_syslog', False, 'output to syslog')
|
||||
flags.DEFINE_string('logfile', None, 'output to named file')
|
||||
|
||||
|
||||
|
||||
# A list of things we want to replicate from logging.
|
||||
# levels
|
||||
CRITICAL = logging.CRITICAL
|
||||
@ -163,8 +157,7 @@ class NovaLogger(logging.Logger):
|
||||
extra = {}
|
||||
if context:
|
||||
extra.update(_dictify_context(context))
|
||||
# TODO(todd): fix after version.py merge
|
||||
#extra.update({"nova_version": version.string_with_vcs()})
|
||||
extra.update({"nova_version": version.string_with_vcs()})
|
||||
logging.Logger._log(self, level, msg, args, exc_info, extra)
|
||||
|
||||
def addHandler(self, handler):
|
||||
|
@ -45,6 +45,7 @@ class RootLoggerTestCase(test.TrialTestCase):
|
||||
log.audit("foo", context=_fake_context())
|
||||
self.assert_(True) # didn't raise exception
|
||||
|
||||
|
||||
class NovaFormatterTestCase(test.TrialTestCase):
|
||||
def setUp(self):
|
||||
super(NovaFormatterTestCase, self).setUp()
|
||||
@ -76,6 +77,7 @@ class NovaFormatterTestCase(test.TrialTestCase):
|
||||
self.log.debug("baz")
|
||||
self.assertEqual("NOCTXT: baz --DBG\n", self.stream.getvalue())
|
||||
|
||||
|
||||
class NovaLoggerTestCase(test.TrialTestCase):
|
||||
def setUp(self):
|
||||
super(NovaLoggerTestCase, self).setUp()
|
||||
@ -93,6 +95,7 @@ class NovaLoggerTestCase(test.TrialTestCase):
|
||||
l = log.getLogger('nova-test.foo')
|
||||
self.assertEqual(log.AUDIT, l.level)
|
||||
|
||||
|
||||
class VerboseLoggerTestCase(test.TrialTestCase):
|
||||
def setUp(self):
|
||||
super(VerboseLoggerTestCase, self).setUp()
|
||||
|
35
nova/version.py
Normal file
35
nova/version.py
Normal file
@ -0,0 +1,35 @@
|
||||
#!/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. :)
|
||||
"""
|
||||
|
||||
version_info = {'branch_nick': u'LOCALBRANCH', 'revision_id': 'LOCALREVISION',
|
||||
'revno': 0}
|
||||
|
||||
revisions = {}
|
||||
|
||||
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 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())
|
39
setup.py
39
setup.py
@ -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']:
|
||||
|
Loading…
Reference in New Issue
Block a user