From 68c1c61b5492ede70cc4187c48fb7b7525185653 Mon Sep 17 00:00:00 2001 From: Craig Vyvial Date: Wed, 4 Nov 2015 17:15:07 -0600 Subject: [PATCH] fix the version info of trove to use pbr Change-Id: I2a445cdea20e70399e331ea4e97042ecd0137c2e Closes-Bug: #1513259 --- doc/source/conf.py | 2 +- trove/__init__.py | 34 ---------------------------------- trove/common/cfg.py | 4 ++-- trove/version.py | 31 ++----------------------------- 4 files changed, 5 insertions(+), 66 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 98968e27e6..2cb17d8d2a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -38,7 +38,7 @@ copyright = u'2013, OpenStack Foundation' # built documents. # # The short X.Y version. -from trove import version as trove_version +from trove.version import version_info as trove_version # The full version, including alpha/beta/rc tags. release = trove_version.version_string_with_vcs() # The short X.Y version. diff --git a/trove/__init__.py b/trove/__init__.py index 7faa682566..e69de29bb2 100644 --- a/trove/__init__.py +++ b/trove/__init__.py @@ -1,34 +0,0 @@ -# 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 -# -# 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. -""" -:mod:`trove` -- Cloud PaaS Database Platform -=================================== - -.. automodule:: trove - :platform: Unix - :synopsis: Platform-As-A-Service Database Cloud -""" - -__all__ = ['__version__'] - -import pbr.version - -version_info = pbr.version.VersionInfo('trove') -# We have a circular import problem when we first run python setup.py sdist -# It's harmless, so deflect it. -try: - __version__ = version_info.version_string() -except AttributeError: - __version__ = None diff --git a/trove/common/cfg.py b/trove/common/cfg.py index 73eba83be7..19b5476c03 100644 --- a/trove/common/cfg.py +++ b/trove/common/cfg.py @@ -20,7 +20,7 @@ import os.path from oslo_config import cfg from oslo_log import log as logging -import trove +from trove.version import version_info as version UNKNOWN_SERVICE_ID = 'unknown-service-id-error' @@ -1200,5 +1200,5 @@ def custom_parser(parsername, parser): def parse_args(argv, default_config_files=None): cfg.CONF(args=argv[1:], project='trove', - version=trove.__version__, + version=version.cached_version_string(), default_config_files=default_config_files) diff --git a/trove/version.py b/trove/version.py index 33656d8f12..92324a15b9 100644 --- a/trove/version.py +++ b/trove/version.py @@ -13,33 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -try: - from trove.vcsversion import version_info -except ImportError: - version_info = {'branch_nick': u'LOCALBRANCH', - 'revision_id': 'LOCALREVISION', - 'revno': 0} +import pbr.version -TROVE_VERSION = ['2012', '1'] -YEAR, COUNT = TROVE_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('trove')