From e0d6375c7595c324aa7cc4f4841a2a04bd68b0f5 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Wed, 6 Aug 2014 16:38:09 +0100 Subject: [PATCH] Update tuskar.version to use PBR Remove the stale code (it isn't 2013!) in tuskar.version and use the common pbr.version as per other OpenStack projects. Change-Id: I9c823a07bb94419634363ed0eae20c9805765a1e --- doc/source/conf.py | 4 ++-- tuskar/common/config.py | 2 +- tuskar/version.py | 49 +++++++++-------------------------------- 3 files changed, 14 insertions(+), 41 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 5243bcf9..f75b117a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -50,9 +50,9 @@ copyright = u'OpenStack Foundation' from tuskar import version as tuskar_version # The full version, including alpha/beta/rc tags. -release = tuskar_version.version_string_with_vcs() +release = tuskar_version.version_info.release_string() # The short X.Y version. -version = tuskar_version.canonical_version_string() +version = tuskar_version.version_info.version_string() # A list of ignored prefixes for module index sorting. modindex_common_prefix = ['tuskar.'] diff --git a/tuskar/common/config.py b/tuskar/common/config.py index 6877a4b9..c25e3670 100644 --- a/tuskar/common/config.py +++ b/tuskar/common/config.py @@ -31,5 +31,5 @@ def parse_args(argv, default_config_files=None): rpc.set_defaults(control_exchange='tuskar') cfg.CONF(argv[1:], project='tuskar', - version=version.version_string(), + version=version.version_info.release_string(), default_config_files=default_config_files) diff --git a/tuskar/version.py b/tuskar/version.py index f5d139ec..56103f4e 100644 --- a/tuskar/version.py +++ b/tuskar/version.py @@ -1,45 +1,18 @@ # Copyright 2011 OpenStack Foundation # All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. -try: - from tuskar.vcsversion import version_info -except ImportError: - version_info = {'branch_nick': u'LOCALBRANCH', - 'revision_id': 'LOCALREVISION', - 'revno': 0} +import pbr.version -TUSKAR_VERSION = ['2013', '1'] -YEAR, COUNT = TUSKAR_VERSION - -FINAL = False # This becomes true at Release Candidate time - - -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 version_string_with_vcs(): - return "%s-%s" % (canonical_version_string(), vcs_version_string()) +version_info = pbr.version.VersionInfo('tuskar')