-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-use-parallel-installed-versions-in-RHEL6.patch
53 lines (47 loc) · 1.79 KB
/
0001-use-parallel-installed-versions-in-RHEL6.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From a62cd977bcf59cfd6b40cfc607364ab698443b85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Fri, 13 Apr 2012 17:24:40 +0100
Subject: [PATCH] use parallel installed versions in RHEL6
of webob sqlalchemy python-routes and paste-deploy
Change-Id: I290f56eae61c87893639a9e5d29f7fff760452cf
---
quantum/__init__.py | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/quantum/__init__.py b/quantum/__init__.py
index 25ce3af..eb5a3fa 100644
--- a/quantum/__init__.py
+++ b/quantum/__init__.py
@@ -15,6 +15,36 @@
# License for the specific language governing permissions and limitations
# under the License.
+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("SQLAlchemy >= 0.6.3")
+replace_dist("Routes >= 1.12.3")
+
+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