diff -Naur Python-2.6.1/Makefile.pre.in Python-2.6.1.patch/Makefile.pre.in
--- Python-2.6.1/Makefile.pre.in	2008-10-21 18:48:37.000000000 +0200
+++ Python-2.6.1.patch/Makefile.pre.in	2009-02-17 13:37:46.000000000 +0100
@@ -175,6 +175,7 @@
 
 PYTHON=		python$(EXE)
 BUILDPYTHON=	python$(BUILDEXE)
+HOSTPYTHON=	$(BUILDPYTHON)
 
 # The task to run while instrument when building the profile-opt target
 PROFILE_TASK=	$(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
@@ -205,6 +206,7 @@
 ##########################################################################
 # Parser
 PGEN=		Parser/pgen$(EXE)
+HOSTPGEN=	$(PGEN)$(EXE)
 
 POBJS=		\
 		Parser/acceler.o \
@@ -394,8 +396,8 @@
 # Build the shared modules
 sharedmods: $(BUILDPYTHON)
 	@case $$MAKEFLAGS in \
-	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
-	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CONFIG_ARGS="$(CONFIG_ARGS)" $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
+	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CONFIG_ARGS="$(CONFIG_ARGS)" $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
 	esac
 
 # Build static library
@@ -513,7 +515,7 @@
 
 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
 		-@$(INSTALL) -d Include
-		-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+		-$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
 
 $(PGEN):	$(PGENOBJS)
 		$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
@@ -993,7 +995,7 @@
 # Install the dynamically loadable modules
 # This goes into $(exec_prefix)
 sharedinstall:
-	$(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+	$(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
 	   	--prefix=$(prefix) \
 		--install-scripts=$(BINDIR) \
 		--install-platlib=$(DESTSHARED) \
diff -Naur Python-2.6.1/setup.py Python-2.6.1.patch/setup.py
--- Python-2.6.1/setup.py	2008-11-04 21:43:31.000000000 +0100
+++ Python-2.6.1.patch/setup.py	2009-02-17 13:39:46.000000000 +0100
@@ -273,6 +273,7 @@
         try:
             imp.load_dynamic(ext.name, ext_filename)
         except ImportError, why:
+            return
             self.failed.append(ext.name)
             self.announce('*** WARNING: renaming "%s" since importing it'
                           ' failed: %s' % (ext.name, why), level=3)
@@ -310,8 +311,18 @@
 
     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')
+        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']
+        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.
@@ -347,12 +358,6 @@
                     for directory in reversed(options.dirs):
                         add_dir_to_list(dir_list, directory)
 
-        if os.path.normpath(sys.prefix) != '/usr':
-            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:
@@ -361,11 +366,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 = []
 
