Make pbr only a build-time dependency.

This lets you build python-swiftclient 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 python-swiftclient 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: I85d4d77aacf094e48d39e48e750594b95dbc7af0
This commit is contained in:
Samuel Merritt 2013-10-08 14:16:32 -07:00
parent 68dde8dd51
commit 7d61c54399
5 changed files with 19 additions and 9 deletions

View File

@ -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]

View File

@ -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.

View File

@ -1,2 +1 @@
pbr>=0.5.21,<1.0
simplejson>=2.0.9

View File

@ -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

View File

@ -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'))