Comment 21 for bug 248558

Revision history for this message
In , Steve (steve-redhat-bugs) wrote :

Well, if that works and the extra paths are not harming anything, I'm fine with using that patch ... at least for now. I'm going to run some tests with a modified version of the patch (- original virtualenv site.py, + my changes to the original virtualenv setup.py)....

--- /tmp/site.py.virtualenv 2008-12-11 19:40:58.000000000 -0500
+++ lib/python2.5/site.py 2008-12-11 20:50:55.000000000 -0500
@@ -201,11 +201,27 @@
                                              "python" + sys.version[:3], "site-packages")]

             elif os.sep == '/':
- sitedirs = [os.path.join(prefix,
- "lib",
- "python" + sys.version[:3],
- "site-packages"),
- os.path.join(prefix, "lib", "site-python")]
+ # PATCH:BZ471617
+ # https://bugzilla.redhat.com/show_bug.cgi?id=471617
+ import platform
+ # Maps the processor type with the library path name
+ lib_map = {'lib': 'lib',
+ 'x86_64': 'lib64'}
+
+ def __easy_path(cpu):
+ """
+ Simply returns a python path based on cpu and lib_map.
+ """
+ if cpu not in lib_map.keys():
+ return ''
+ return os.path.join(prefix,
+ lib_map[cpu],
+ "python" + sys.version[:3],
+ "site-packages")
+
+ sitedirs = [__easy_path("lib")]
+ sitedirs.append(__easy_path(platform.processor()))
+ # END PATCH:BZ471617
                 try:
                     # sys.getobjects only available in --with-pydebug build
                     sys.getobjects