add build branch
[openstack-build/neutron-build.git] / rpm / SOURCES / 0001-use-parallel-installed-versions-in-RHEL6.patch
1 From a62cd977bcf59cfd6b40cfc607364ab698443b85 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
3 Date: Fri, 13 Apr 2012 17:24:40 +0100
4 Subject: [PATCH] use parallel installed versions in RHEL6
5
6 of webob sqlalchemy python-routes and paste-deploy
7
8 Change-Id: I290f56eae61c87893639a9e5d29f7fff760452cf
9 ---
10  quantum/__init__.py |   30 ++++++++++++++++++++++++++++++
11  1 files changed, 30 insertions(+), 0 deletions(-)
12
13 diff --git a/quantum/__init__.py b/quantum/__init__.py
14 index 25ce3af..eb5a3fa 100644
15 --- a/quantum/__init__.py
16 +++ b/quantum/__init__.py
17 @@ -15,6 +15,36 @@
18  #    License for the specific language governing permissions and limitations
19  #    under the License.
20  
21 +import sys
22 +import pkg_resources
23 +
24 +# If there is a conflicting non egg module,
25 +# i.e. an older standard system module installed,
26 +# then replace it with this requirement
27 +def replace_dist(requirement):
28 +    try:
29 +        return pkg_resources.require(requirement)
30 +    except pkg_resources.VersionConflict:
31 +        e = sys.exc_info()[1]
32 +        dist=e.args[0]
33 +        req=e.args[1]
34 +        if dist.key == req.key and not dist.location.endswith('.egg'):
35 +            del pkg_resources.working_set.by_key[dist.key]
36 +            # We assume there is no need to adjust sys.path
37 +            # and the associated pkg_resources.working_set.entries
38 +            return pkg_resources.require(requirement)
39 +
40 +replace_dist("WebOb >= 1.0")
41 +replace_dist("SQLAlchemy >= 0.6.3")
42 +replace_dist("Routes >= 1.12.3")
43 +
44 +replace_dist("PasteDeploy >= 1.5.0")
45 +# This hack is needed because replace_dist() results in
46 +# the standard paste module path being at the start of __path__.
47 +# TODO: See can we get pkg_resources to do the right thing directly
48 +import paste
49 +paste.__path__.insert(0, paste.__path__.pop(-1))
50 +
51  import gettext
52  
53