summaryrefslogtreecommitdiff
path: root/heatclient/__init__.py
diff options
context:
space:
mode:
authorSteve Baker <sbaker@redhat.com>2012-10-12 16:50:43 +1300
committerSteve Baker <sbaker@redhat.com>2012-10-12 16:50:43 +1300
commit3c9c859e817695d3833c522ef4fcb386f70ebe60 (patch)
treecac9ea29afd96cc5e3b83a91cbf5d750b7ac51af /heatclient/__init__.py
parent70619f8945b48dcd2ef9c115e1f1aa9a8ee32f15 (diff)
downloadpython-heatclient-3c9c859e817695d3833c522ef4fcb386f70ebe60.tar.gz
Get fakes and mox working so that any http request/response sequence can be
test scripted
Diffstat (limited to 'heatclient/__init__.py')
-rw-r--r--heatclient/__init__.py47
1 files changed, 26 insertions, 21 deletions
diff --git a/heatclient/__init__.py b/heatclient/__init__.py
index 0585a75..09d0195 100644
--- a/heatclient/__init__.py
+++ b/heatclient/__init__.py
@@ -1,26 +1,31 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# 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.
+import inspect
+import os
+
+
+def _get_heatclient_version():
+ """Read version from versioninfo file."""
+ mod_abspath = inspect.getabsfile(inspect.currentframe())
+ heatclient_path = os.path.dirname(mod_abspath)
+ version_path = os.path.join(heatclient_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
-#NOTE(bcwaldon): this try/except block is needed to run setup.py due to
-# its need to import local code before installing required dependencies
-try:
- import heatclient.client
- Client = heatclient.client.Client
-except ImportError:
- import warnings
- warnings.warn("Could not import heatclient.client", ImportWarning)
+ return version
-import heatclient.version
-__version__ = heatclient.version.version_info.deferred_version_string()
+__version__ = _get_heatclient_version()