Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | When cross compiling python, we used to need to install the Makefile, pyconfig.h |
| 2 | and the python library to their final location before being able to compile the |
| 3 | rest of python. This change allows us to point python at its own source when |
| 4 | building, avoiding a variety of sysroot staging issues and simplifying the main |
| 5 | python recipe. |
| 6 | |
| 7 | Upstream-Status: Inappropriate |
| 8 | RP 2012/11/13 |
| 9 | |
| 10 | Index: Python-2.7.9/Lib/sysconfig.py |
| 11 | =================================================================== |
| 12 | --- Python-2.7.9.orig/Lib/sysconfig.py |
| 13 | +++ Python-2.7.9/Lib/sysconfig.py |
| 14 | @@ -93,6 +93,7 @@ _PREFIX = os.path.normpath(sys.prefix) |
| 15 | _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) |
| 16 | _CONFIG_VARS = None |
| 17 | _USER_BASE = None |
| 18 | +_PYTHONBUILDDIR = os.environ.get("PYTHONBUILDDIR", None) |
| 19 | |
| 20 | def _safe_realpath(path): |
| 21 | try: |
| 22 | @@ -100,7 +101,9 @@ def _safe_realpath(path): |
| 23 | except OSError: |
| 24 | return path |
| 25 | |
| 26 | -if sys.executable: |
| 27 | +if _PYTHONBUILDDIR: |
| 28 | + _PROJECT_BASE = _PYTHONBUILDDIR |
| 29 | +elif sys.executable: |
| 30 | _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable)) |
| 31 | else: |
| 32 | # sys.executable can be empty if argv[0] has been changed and Python is |
| 33 | Index: Python-2.7.9/Lib/distutils/sysconfig.py |
| 34 | =================================================================== |
| 35 | --- Python-2.7.9.orig/Lib/distutils/sysconfig.py |
| 36 | +++ Python-2.7.9/Lib/distutils/sysconfig.py |
| 37 | @@ -26,6 +26,9 @@ EXEC_PREFIX = os.path.normpath(sys.exec_ |
| 38 | # live in project/PCBuild9. If we're dealing with an x64 Windows build, |
| 39 | # it'll live in project/PCbuild/amd64. |
| 40 | project_base = os.path.dirname(os.path.abspath(sys.executable)) |
| 41 | +_PYTHONBUILDDIR = os.environ.get("PYTHONBUILDDIR", None) |
| 42 | +if _PYTHONBUILDDIR: |
| 43 | + project_base = _PYTHONBUILDDIR |
| 44 | if os.name == "nt" and "pcbuild" in project_base[-8:].lower(): |
| 45 | project_base = os.path.abspath(os.path.join(project_base, os.path.pardir)) |
| 46 | # PC/VS7.1 |