When cross compiling python, we used to need to install the Makefile, pyconfig.h 
and the python library to their final location before being able to compile the 
rest of python. This change allows us to point python at its own source when
building, avoiding a variety of sysroot staging issues and simplifying the main
python recipe.

Upstream-Status: Inappropriate
RP 2012/11/13

Index: Python-2.7.9/Lib/sysconfig.py
===================================================================
--- Python-2.7.9.orig/Lib/sysconfig.py
+++ Python-2.7.9/Lib/sysconfig.py
@@ -93,6 +93,7 @@ _PREFIX = os.path.normpath(sys.prefix)
 _EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
 _CONFIG_VARS = None
 _USER_BASE = None
+_PYTHONBUILDDIR = os.environ.get("PYTHONBUILDDIR", None)
 
 def _safe_realpath(path):
     try:
@@ -100,7 +101,9 @@ def _safe_realpath(path):
     except OSError:
         return path
 
-if sys.executable:
+if _PYTHONBUILDDIR:
+    _PROJECT_BASE = _PYTHONBUILDDIR
+elif sys.executable:
     _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable))
 else:
     # sys.executable can be empty if argv[0] has been changed and Python is
Index: Python-2.7.9/Lib/distutils/sysconfig.py
===================================================================
--- Python-2.7.9.orig/Lib/distutils/sysconfig.py
+++ Python-2.7.9/Lib/distutils/sysconfig.py
@@ -26,6 +26,9 @@ EXEC_PREFIX = os.path.normpath(sys.exec_
 # live in project/PCBuild9.  If we're dealing with an x64 Windows build,
 # it'll live in project/PCbuild/amd64.
 project_base = os.path.dirname(os.path.abspath(sys.executable))
+_PYTHONBUILDDIR = os.environ.get("PYTHONBUILDDIR", None)
+if _PYTHONBUILDDIR:
+    project_base = _PYTHONBUILDDIR
 if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
     project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
 # PC/VS7.1
