|
|
372501a |
From e4290b5492a953f881114b65e6025fbbb7707122 Mon Sep 17 00:00:00 2001
|
|
|
372501a |
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
|
|
372501a |
Date: Wed, 9 Oct 2013 12:04:27 +0100
|
|
|
372501a |
Subject: [PATCH] Use updated parallel install versions of el6 packages
|
|
Pete Zaitcev |
0c48f67 |
|
|
Pete Zaitcev |
0c48f67 |
---
|
|
|
372501a |
swift/__init__.py | 25 +++++++++++++++++++++++++
|
|
|
372501a |
1 files changed, 25 insertions(+), 0 deletions(-)
|
|
Pete Zaitcev |
0c48f67 |
|
|
Pete Zaitcev |
0c48f67 |
diff --git a/swift/__init__.py b/swift/__init__.py
|
|
|
372501a |
index 7e8fb7b..3a11a77 100644
|
|
Pete Zaitcev |
0c48f67 |
--- a/swift/__init__.py
|
|
Pete Zaitcev |
0c48f67 |
+++ b/swift/__init__.py
|
|
|
372501a |
@@ -12,6 +12,31 @@
|
|
|
372501a |
# implied.
|
|
|
372501a |
# See the License for the specific language governing permissions and
|
|
|
372501a |
# limitations under the License.
|
|
Pete Zaitcev |
0c48f67 |
+import sys
|
|
Pete Zaitcev |
0c48f67 |
+import pkg_resources
|
|
Pete Zaitcev |
0c48f67 |
+
|
|
Pete Zaitcev |
0c48f67 |
+# If there is a conflicting non egg module,
|
|
Pete Zaitcev |
0c48f67 |
+# i.e. an older standard system module installed,
|
|
Pete Zaitcev |
0c48f67 |
+# then replace it with this requirement
|
|
Pete Zaitcev |
0c48f67 |
+def replace_dist(requirement):
|
|
Pete Zaitcev |
0c48f67 |
+ try:
|
|
Pete Zaitcev |
0c48f67 |
+ return pkg_resources.require(requirement)
|
|
Pete Zaitcev |
0c48f67 |
+ except pkg_resources.VersionConflict:
|
|
Pete Zaitcev |
0c48f67 |
+ e = sys.exc_info()[1]
|
|
Pete Zaitcev |
0c48f67 |
+ dist=e.args[0]
|
|
Pete Zaitcev |
0c48f67 |
+ req=e.args[1]
|
|
Pete Zaitcev |
0c48f67 |
+ if dist.key == req.key and not dist.location.endswith('.egg'):
|
|
Pete Zaitcev |
0c48f67 |
+ del pkg_resources.working_set.by_key[dist.key]
|
|
Pete Zaitcev |
0c48f67 |
+ # We assume there is no need to adjust sys.path
|
|
Pete Zaitcev |
0c48f67 |
+ # and the associated pkg_resources.working_set.entries
|
|
Pete Zaitcev |
0c48f67 |
+ return pkg_resources.require(requirement)
|
|
Pete Zaitcev |
0c48f67 |
+
|
|
Pete Zaitcev |
0c48f67 |
+replace_dist("PasteDeploy >= 1.5.0")
|
|
Pete Zaitcev |
0c48f67 |
+# This hack is needed because replace_dist() results in
|
|
Pete Zaitcev |
0c48f67 |
+# the standard paste module path being at the start of __path__.
|
|
Pete Zaitcev |
0c48f67 |
+# TODO: See can we get pkg_resources to do the right thing directly
|
|
Pete Zaitcev |
0c48f67 |
+import paste
|
|
Pete Zaitcev |
0c48f67 |
+paste.__path__.insert(0, paste.__path__.pop(-1))
|
|
|
372501a |
|
|
|
372501a |
import os
|
|
|
372501a |
import gettext
|