summaryrefslogtreecommitdiff
path: root/taskflow/version.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2014-09-01 09:48:21 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-09-01 20:09:59 +0000
commit1eabee4c8b2faee518b726e08567b1ff9444505b (patch)
tree4fa5e6c56938f82632b6ef6614a536f9c54ca0c6 /taskflow/version.py
parent45427dce0eee3762c6ef019547f31dfe9718a58a (diff)
downloadtaskflow-1eabee4c8b2faee518b726e08567b1ff9444505b.tar.gz
Make version.py handle pbr not being installed
Since pbr is now only a dev/build-time requirement of taskflow and not a run-time or test-time requirement we should not have a version file that explicitly requires pbr to exist to function correctly. To accommodate when pbr is not found use the pkg_resources function that can provide the installed version instead so that we still provide back a valid version. Change-Id: Id191d2b38def54b95a3467b4023a9540c284660d
Diffstat (limited to 'taskflow/version.py')
-rw-r--r--taskflow/version.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/taskflow/version.py b/taskflow/version.py
index 1777ba6..7f7fcd9 100644
--- a/taskflow/version.py
+++ b/taskflow/version.py
@@ -14,17 +14,19 @@
# License for the specific language governing permissions and limitations
# under the License.
-from pbr import version as pbr_version
+import pkg_resources
TASK_VENDOR = "OpenStack Foundation"
TASK_PRODUCT = "OpenStack TaskFlow"
TASK_PACKAGE = None # OS distro package version suffix
-version_info = pbr_version.VersionInfo('taskflow')
-
-
-def version_string():
- return version_info.version_string()
+try:
+ from pbr import version as pbr_version
+ _version_info = pbr_version.VersionInfo('taskflow')
+ version_string = _version_info.version_string
+except ImportError:
+ _version_info = pkg_resources.get_distribution('taskflow')
+ version_string = lambda: _version_info.version
def version_string_with_package():