From: W. Trevor King Date: Mon, 6 Sep 2010 01:20:46 +0000 (-0400) Subject: Default to "unknown" version info if libbe._version is missing. X-Git-Tag: 1.0.0~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=70910ac62711282502e67d31b8600bd5beb43cc9;p=be.git Default to "unknown" version info if libbe._version is missing. --- diff --git a/libbe/command/show.py b/libbe/command/show.py index c6ad37d..27be07c 100644 --- a/libbe/command/show.py +++ b/libbe/command/show.py @@ -26,7 +26,6 @@ import libbe.command import libbe.command.util import libbe.util.id import libbe.version -import libbe._version class Show (libbe.command.Command): @@ -158,7 +157,7 @@ def _xml_header(encoding): ' ', ' %s' % libbe.version.version()] for tag in ['branch-nick', 'revno', 'revision-id']: - value = libbe._version.version_info[tag.replace('-', '_')] + value = libbe.version.version_info[tag.replace('-', '_')] lines.append(' <%s>%s' % (tag, value, tag)) lines.append(' ') return lines diff --git a/libbe/version.py b/libbe/version.py index 2df0185..3246c97 100644 --- a/libbe/version.py +++ b/libbe/version.py @@ -27,8 +27,17 @@ over the version strings" workflows. import copy -import libbe._version as _version import libbe.storage +try: + from ._version import version_info +except ImportError, e: + import logging + logging.warn('unable to import libbe._version: %s' % e) + version_info = { + 'revision': 'unknown', + 'date': 'unknown', + 'committer': 'unknown', + } # Manually set a version string (optional, defaults to bzr revision id) #_VERSION = "1.2.3" @@ -42,9 +51,9 @@ def version(verbose=False): if "_VERSION" in globals(): string = _VERSION else: - string = _version.version_info['revision'] + string = version_info['revision'] if verbose == True: - info = copy.copy(_version.version_info) + info = copy.copy(version_info) info['storage'] = libbe.storage.STORAGE_VERSION string += ("\n" "revision: %(revision)s\n"