Make pbr a build-time only dependency

This lets you build swift packages that don't require pbr
to be installed at all. You would need pbr on the machine running
rpmbuild / debuild, but not on the machines that install the packages.

Unfortunately, this does not make swift able to be
installed via pip 0.3.1 on Lucid; you'll need to uninstall the system
python-pip package and install a new pip some other way. Given that
pip < 1.3 doesn't perform SSL certificate validation for pypi (trivial
MITM attack, anyone?), you'd probably want to get a new pip anyway.

Change-Id: Ia50a229c5ae4dd2158beeaa953619b5e8f987c55
This commit is contained in:
John Dickinson 2013-10-29 12:29:49 -07:00
parent 4bfe6748fd
commit 0717133197
2 changed files with 15 additions and 7 deletions

View File

@ -1,4 +1,3 @@
pbr>=0.5.21,<1.0
dnspython>=1.9.4
eventlet>=0.9.15
greenlet>=0.3.1

View File

@ -16,13 +16,22 @@
import os
import gettext
import pbr.version
_version_info = pbr.version.VersionInfo('swift')
__version__ = _version_info.release_string()
__canonical_version__ = _version_info.version_string()
import pkg_resources
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__ = __canonical_version__ = pkg_resources.get_provider(
pkg_resources.Requirement.parse('swift')).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_info = pbr.version.VersionInfo('swift')
__version__ = _version_info.release_string()
__canonical_version__ = _version_info.version_string()
_localedir = os.environ.get('SWIFT_LOCALEDIR')
_t = gettext.translation('swift', localedir=_localedir, fallback=True)