summaryrefslogtreecommitdiff
path: root/cinderclient/__init__.py
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2012-11-30 14:05:54 -0800
committerMonty Taylor <mordred@inaugust.com>2012-11-30 14:05:54 -0800
commit5adf79136042004ceb76d3d1e68e0ab08edf1917 (patch)
tree46ad543140c25396dcc7a006d07f2620d8a594b9 /cinderclient/__init__.py
parenta74dee000e682b5b227cd9032df6719aa22ffb00 (diff)
downloadpython-cinderclient-5adf79136042004ceb76d3d1e68e0ab08edf1917.tar.gz
Align cinderclient version code.
Change-Id: I81d6a279a52656720626357a1c4ca8bb382ef1f8
Diffstat (limited to 'cinderclient/__init__.py')
-rw-r--r--cinderclient/__init__.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/cinderclient/__init__.py b/cinderclient/__init__.py
index e69de29..1f8ab19 100644
--- a/cinderclient/__init__.py
+++ b/cinderclient/__init__.py
@@ -0,0 +1,36 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 OpenStack LLC
+#
+# 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.
+
+import os
+import inspect
+
+
+def _get_client_version():
+ """Read version from versioninfo file."""
+ mod_abspath = inspect.getabsfile(inspect.currentframe())
+ client_path = os.path.dirname(mod_abspath)
+ version_path = os.path.join(client_path, 'versioninfo')
+
+ if os.path.exists(version_path):
+ version = open(version_path).read().strip()
+ else:
+ version = "Unknown, couldn't find versioninfo file at %s"\
+ % version_path
+
+ return version
+
+
+__version__ = _get_client_version()