From 43e8681d5cbd6c919e379fe25cccc189827e2d60 Mon Sep 17 00:00:00 2001 From: Alan Pevec Date: Wed, 4 Jan 2012 00:15:05 +0100 Subject: [PATCH] Use updated parallel install versions of epel package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use WebOb >= 1.0 and depend on the EPEL parallel installable versions of the package to satisfy those requirements. Based on Nova/Glance EPEL patch by Pádraig Brady --- swift/__init__.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/swift/__init__.py b/swift/__init__.py index 9065801..9600d1e 100644 --- a/swift/__init__.py +++ b/swift/__init__.py @@ -1,3 +1,32 @@ +import sys +import pkg_resources + +# If there is a conflicting non egg module, +# i.e. an older standard system module installed, +# then replace it with this requirement +def replace_dist(requirement): + try: + return pkg_resources.require(requirement) + except pkg_resources.VersionConflict: + e = sys.exc_info()[1] + dist=e.args[0] + req=e.args[1] + if dist.key == req.key and not dist.location.endswith('.egg'): + del pkg_resources.working_set.by_key[dist.key] + # We assume there is no need to adjust sys.path + # and the associated pkg_resources.working_set.entries + return pkg_resources.require(requirement) + +replace_dist("WebOb >= 1.0") + +replace_dist("PasteDeploy >= 1.5.0") +# This hack is needed because replace_dist() results in +# the standard paste module path being at the start of __path__. +# TODO: See can we get pkg_resources to do the right thing directly +import paste +paste.__path__.insert(0, paste.__path__.pop(-1)) + + import gettext