diff -Naur Python-2.7.2/setup.py Python-2.7.2.patch/setup.py
--- Python-2.7.2/setup.py	2011-10-25 14:07:59.520264628 +0200
+++ Python-2.7.2.patch/setup.py	2011-10-25 14:16:32.218793079 +0200
@@ -380,10 +380,19 @@
             os.unlink(tmpfile)
 
     def detect_modules(self):
-        # Ensure that /usr/local is always used
-        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-        self.add_multiarch_paths()
+        try:
+            modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
+        except KeyError:
+            modules_include_dirs = ['/usr/include']
+        try:
+            modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
+        except KeyError:
+            modules_lib_dirs = ['/usr/lib']
+            self.add_multiarch_paths()
+        for dir in modules_include_dirs:
+                add_dir_to_list(self.compiler.include_dirs, dir)
+        for dir in modules_lib_dirs:
+                add_dir_to_list(self.compiler.library_dirs, dir)
 
         # Add paths specified in the environment variables LDFLAGS and
         # CPPFLAGS for header and library files.
@@ -419,17 +428,6 @@
                     for directory in reversed(options.dirs):
                         add_dir_to_list(dir_list, directory)
 
-        if os.path.normpath(sys.prefix) != '/usr' \
-                and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
-            # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
-            # (PYTHONFRAMEWORK is set) to avoid # linking problems when
-            # building a framework with different architectures than
-            # the one that is currently installed (issue #7473)
-            add_dir_to_list(self.compiler.library_dirs,
-                            sysconfig.get_config_var("LIBDIR"))
-            add_dir_to_list(self.compiler.include_dirs,
-                            sysconfig.get_config_var("INCLUDEDIR"))
-
         try:
             have_unicode = unicode
         except NameError:
@@ -438,11 +436,8 @@
         # lib_dirs and inc_dirs are used to search for files;
         # if a file is found in one of those directories, it can
         # be assumed that no additional -I,-L directives are needed.
-        lib_dirs = self.compiler.library_dirs + [
-            '/lib64', '/usr/lib64',
-            '/lib', '/usr/lib',
-            ]
-        inc_dirs = self.compiler.include_dirs + ['/usr/include']
+        lib_dirs = self.compiler.library_dirs
+        inc_dirs = self.compiler.include_dirs
         exts = []
         missing = []
 
