Change version reporting to use pbr

Gets rid of the hard-coded version string in shell.py

Change-Id: I8b818c9a8f1224669079141e7a7caf614e588d20
This commit is contained in:
Dean Troyer 2013-08-02 11:57:17 -05:00
parent d67524897b
commit af87489022
2 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,3 @@
# Copyright 2012-2013 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
# a copy of the License at # a copy of the License at
@ -12,3 +10,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# #
__all__ = ['__version__']
import pbr.version
version_info = pbr.version.VersionInfo('python-openstackclient')
try:
__version__ = version_info.version_string()
except AttributeError:
__version__ = None

View File

@ -24,6 +24,7 @@ import sys
from cliff import app from cliff import app
from cliff import help from cliff import help
import openstackclient
from openstackclient.common import clientmanager from openstackclient.common import clientmanager
from openstackclient.common import commandmanager from openstackclient.common import commandmanager
from openstackclient.common import exceptions as exc from openstackclient.common import exceptions as exc
@ -31,7 +32,6 @@ from openstackclient.common import openstackkeyring
from openstackclient.common import utils from openstackclient.common import utils
VERSION = '0.2.rc1'
KEYRING_SERVICE = 'openstack' KEYRING_SERVICE = 'openstack'
DEFAULT_COMPUTE_API_VERSION = '2' DEFAULT_COMPUTE_API_VERSION = '2'
@ -64,7 +64,7 @@ class OpenStackShell(app.App):
def __init__(self): def __init__(self):
super(OpenStackShell, self).__init__( super(OpenStackShell, self).__init__(
description=__doc__.strip(), description=__doc__.strip(),
version=VERSION, version=openstackclient.__version__,
command_manager=commandmanager.CommandManager('openstack.cli')) command_manager=commandmanager.CommandManager('openstack.cli'))
# This is instantiated in initialize_app() only when using # This is instantiated in initialize_app() only when using