Update RPM specs to v. 2014.1.1
[openstack-build/neutron-build.git] / rpm / SOURCES / 0001-use-parallel-installed-versions-in-RHEL6.patch
1 From 51ccb186c88ad108eb5e9f808d987c068ac5ecc5 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 paste-deploy python-jinja2-26
7
8 Change-Id: I290f56eae61c87893639a9e5d29f7fff760452cf
9 ---
10  neutron/__init__.py | 31 +++++++++++++++++++++++++++++++
11  1 file changed, 31 insertions(+)
12
13 diff --git a/neutron/__init__.py b/neutron/__init__.py
14 index b2c81bd..fef4d32 100644
15 --- a/neutron/__init__.py
16 +++ b/neutron/__init__.py
17 @@ -15,6 +15,37 @@
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.2")
41 +replace_dist("SQLAlchemy >= 0.6.3")
42 +replace_dist("Routes >= 1.12.3")
43 +replace_dist("Jinja2 >= 2.6")
44 +
45 +replace_dist("PasteDeploy >= 1.5.0")
46 +# This hack is needed because replace_dist() results in
47 +# the standard paste module path being at the start of __path__.
48 +# TODO: See can we get pkg_resources to do the right thing directly
49 +import paste
50 +paste.__path__.insert(0, paste.__path__.pop(-1))
51 +
52  import gettext
53  
54