Skip to content

Commit af87489

Browse files
author
Dean Troyer
committed
Change version reporting to use pbr
Gets rid of the hard-coded version string in shell.py Change-Id: I8b818c9a8f1224669079141e7a7caf614e588d20
1 parent d675248 commit af87489

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

openstackclient/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Copyright 2012-2013 OpenStack, LLC.
2-
#
31
# Licensed under the Apache License, Version 2.0 (the "License"); you may
42
# not use this file except in compliance with the License. You may obtain
53
# a copy of the License at
@@ -12,3 +10,13 @@
1210
# License for the specific language governing permissions and limitations
1311
# under the License.
1412
#
13+
14+
__all__ = ['__version__']
15+
16+
import pbr.version
17+
18+
version_info = pbr.version.VersionInfo('python-openstackclient')
19+
try:
20+
__version__ = version_info.version_string()
21+
except AttributeError:
22+
__version__ = None

openstackclient/shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
from cliff import app
2525
from cliff import help
2626

27+
import openstackclient
2728
from openstackclient.common import clientmanager
2829
from openstackclient.common import commandmanager
2930
from openstackclient.common import exceptions as exc
3031
from openstackclient.common import openstackkeyring
3132
from openstackclient.common import utils
3233

3334

34-
VERSION = '0.2.rc1'
3535
KEYRING_SERVICE = 'openstack'
3636

3737
DEFAULT_COMPUTE_API_VERSION = '2'
@@ -64,7 +64,7 @@ class OpenStackShell(app.App):
6464
def __init__(self):
6565
super(OpenStackShell, self).__init__(
6666
description=__doc__.strip(),
67-
version=VERSION,
67+
version=openstackclient.__version__,
6868
command_manager=commandmanager.CommandManager('openstack.cli'))
6969

7070
# This is instantiated in initialize_app() only when using

0 commit comments

Comments
 (0)