diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-10-10 22:51:47 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-10-10 22:51:47 +0000 |
commit | 1aa85960fdbf6e570a55821c2361a0747e21a72a (patch) | |
tree | 86e940fbf30aded005efafb7fc9fe11ebb6674dd | |
parent | 0cded7cfed9c2840b8a9538b03ccb2b72065aafc (diff) | |
parent | 7d61c543993638caf5dbe176ed6c077ee506d87e (diff) | |
download | python-swiftclient-1aa85960fdbf6e570a55821c2361a0747e21a72a.tar.gz |
Merge "Make pbr only a build-time dependency."1.8.0
-rwxr-xr-x | bin/swift | 4 | ||||
-rw-r--r-- | doc/source/conf.py | 6 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | swiftclient/__init__.py | 2 | ||||
-rw-r--r-- | swiftclient/version.py | 15 |
5 files changed, 19 insertions, 9 deletions
@@ -36,7 +36,7 @@ from swiftclient import Connection, HTTPException from swiftclient.utils import config_true_value from swiftclient.multithreading import MultiThreadingManager from swiftclient.exceptions import ClientException -from swiftclient.version import version_info +from swiftclient import __version__ as client_version def get_conn(options): @@ -1262,7 +1262,7 @@ adding "-V 2" is necessary for this.'''.strip('\n')) if __name__ == '__main__': - version = version_info.version_string() + version = client_version parser = OptionParser(version='%%prog %s' % version, usage=''' usage: %%prog [--version] [--help] [--snet] [--verbose] diff --git a/doc/source/conf.py b/doc/source/conf.py index 356b89e..19bc85c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -57,9 +57,9 @@ copyright = u'2013 OpenStack, LLC.' # |version| and |release|, also used in various other places throughout the # built documents. # -from swiftclient.version import version_info as swiftclient_version -release = swiftclient_version.version_string() -version = swiftclient_version.version_string() +import swiftclient.version +release = swiftclient.version.version_string +version = swiftclient.version.version_string # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/requirements.txt b/requirements.txt index 42104ec..519b048 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ -pbr>=0.5.21,<1.0 simplejson>=2.0.9 diff --git a/swiftclient/__init__.py b/swiftclient/__init__.py index 1d74249..c4b7d45 100644 --- a/swiftclient/__init__.py +++ b/swiftclient/__init__.py @@ -27,6 +27,6 @@ from .client import * try: from swiftclient import version - __version__ = version.version_info.cached_version_string() + __version__ = version.version_string except Exception: pass diff --git a/swiftclient/version.py b/swiftclient/version.py index 7bb5d18..494d6ec 100644 --- a/swiftclient/version.py +++ b/swiftclient/version.py @@ -14,6 +14,17 @@ # License for the specific language governing permissions and limitations # under the License. -from pbr import version as pbr_version +import pkg_resources -version_info = pbr_version.VersionInfo('python-swiftclient') +try: + # First, try to get our version out of PKG-INFO. If we're installed, + # this'll let us find our version without pulling in pbr. After all, if + # we're installed on a system, we're not in a Git-managed source tree, so + # pbr doesn't really buy us anything. + version_string = pkg_resources.get_provider( + pkg_resources.Requirement.parse('python-swiftclient')).version +except pkg_resources.DistributionNotFound: + # No PKG-INFO? We're probably running from a checkout, then. Let pbr do + # its thing to figure out a version number. + import pbr.version + version_string = str(pbr.version.VersionInfo('python-swiftclient')) |