Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Upstream-Status: Inappropriate [embedded specific] |
| 2 | |
| 3 | 02/2015 Rebased for Python 3.4.2 |
| 4 | |
| 5 | # The proper prefix is inside our staging area. |
| 6 | # Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de> |
| 7 | # Signed-off-by: Phil Blundell <philb@gnu.org> |
| 8 | # Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 9 | # Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> |
| 10 | |
| 11 | Index: Python-3.4.2/Lib/distutils/sysconfig.py |
| 12 | =================================================================== |
| 13 | --- Python-3.4.2.orig/Lib/distutils/sysconfig.py |
| 14 | +++ Python-3.4.2/Lib/distutils/sysconfig.py |
| 15 | @@ -16,10 +16,11 @@ import sys |
| 16 | from .errors import DistutilsPlatformError |
| 17 | |
| 18 | # These are needed in a couple of spots, so just compute them once. |
| 19 | -PREFIX = os.path.normpath(sys.prefix) |
| 20 | -EXEC_PREFIX = os.path.normpath(sys.exec_prefix) |
| 21 | -BASE_PREFIX = os.path.normpath(sys.base_prefix) |
| 22 | -BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) |
| 23 | +PREFIX = os.path.normpath(sys.prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 24 | +EXEC_PREFIX = os.path.normpath(sys.exec_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 25 | +BASE_PREFIX = os.path.normpath(sys.base_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 26 | +BASE_EXEC_PREFIX= os.path.normpath(sys.base_exec_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 27 | + |
| 28 | |
| 29 | # Path to the base directory of the project. On Windows the binary may |
| 30 | # live in project/PCBuild9. If we're dealing with an x64 Windows build, |
| 31 | @@ -93,7 +94,9 @@ def get_python_inc(plat_specific=0, pref |
| 32 | If 'prefix' is supplied, use it instead of sys.base_prefix or |
| 33 | sys.base_exec_prefix -- i.e., ignore 'plat_specific'. |
| 34 | """ |
| 35 | - if prefix is None: |
| 36 | + if prefix is None and os.environ['STAGING_INCDIR'] != "": |
| 37 | + prefix = os.environ['STAGING_INCDIR'].rstrip('include') |
| 38 | + elif prefix is None: |
| 39 | prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX |
| 40 | if os.name == "posix": |
| 41 | if python_build: |
| 42 | @@ -134,6 +137,12 @@ def get_python_lib(plat_specific=0, stan |
| 43 | If 'prefix' is supplied, use it instead of sys.base_prefix or |
| 44 | sys.base_exec_prefix -- i.e., ignore 'plat_specific'. |
| 45 | """ |
| 46 | + if prefix is None and os.environ['STAGING_LIBDIR'] != "": |
| 47 | + lib_basename = os.environ['STAGING_LIBDIR'].split('/')[-1] |
| 48 | + prefix = os.environ['STAGING_LIBDIR'].rstrip(lib_basename) |
| 49 | + else: |
| 50 | + lib_basename = sys.lib |
| 51 | + |
| 52 | if prefix is None: |
| 53 | if standard_lib: |
| 54 | prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX |
| 55 | @@ -142,7 +151,7 @@ def get_python_lib(plat_specific=0, stan |
| 56 | |
| 57 | if os.name == "posix": |
| 58 | libpython = os.path.join(prefix, |
| 59 | - "lib", "python" + get_python_version()) |
| 60 | + lib_basename, "python" + get_python_version()) |
| 61 | if standard_lib: |
| 62 | return libpython |
| 63 | else: |
| 64 | @@ -242,7 +251,7 @@ def get_config_h_filename(): |
| 65 | else: |
| 66 | inc_dir = get_python_inc(plat_specific=1) |
| 67 | |
| 68 | - return os.path.join(inc_dir, 'pyconfig.h') |
| 69 | + return os.path.join(inc_dir, 'pyconfig.h'.replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )) |
| 70 | |
| 71 | |
| 72 | def get_makefile_filename(): |
| 73 | @@ -251,7 +260,7 @@ def get_makefile_filename(): |
| 74 | return os.path.join(_sys_home or project_base, "Makefile") |
| 75 | lib_dir = get_python_lib(plat_specific=0, standard_lib=1) |
| 76 | config_file = 'config-{}{}'.format(get_python_version(), build_flags) |
| 77 | - return os.path.join(lib_dir, config_file, 'Makefile') |
| 78 | + return os.path.join(lib_dir, config_file, 'Makefile').replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 79 | |
| 80 | |
| 81 | def parse_config_h(fp, g=None): |