Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From d4dd67daa1555bf13272cc071706338572539bad Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Tue, 14 May 2013 15:00:26 -0700 |
| 4 | Subject: [PATCH 01/20] python3: Add target and native recipes |
| 5 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | Upstream-Status: Inappropriate [embedded specific] |
| 7 | |
| 8 | 02/2015 Rebased for Python 3.4.2 |
| 9 | |
| 10 | # The proper prefix is inside our staging area. |
| 11 | # Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de> |
| 12 | # Signed-off-by: Phil Blundell <philb@gnu.org> |
| 13 | # Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | # Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> |
| 15 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 16 | --- |
| 17 | diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py |
| 18 | index 573724d..418b478 100644 |
| 19 | --- a/Lib/distutils/sysconfig.py |
| 20 | +++ b/Lib/distutils/sysconfig.py |
| 21 | @@ -17,10 +17,11 @@ import sys |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | from .errors import DistutilsPlatformError |
| 23 | |
| 24 | # These are needed in a couple of spots, so just compute them once. |
| 25 | -PREFIX = os.path.normpath(sys.prefix) |
| 26 | -EXEC_PREFIX = os.path.normpath(sys.exec_prefix) |
| 27 | -BASE_PREFIX = os.path.normpath(sys.base_prefix) |
| 28 | -BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) |
| 29 | +PREFIX = os.path.normpath(sys.prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 30 | +EXEC_PREFIX = os.path.normpath(sys.exec_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 31 | +BASE_PREFIX = os.path.normpath(sys.base_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 32 | +BASE_EXEC_PREFIX= os.path.normpath(sys.base_exec_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 33 | + |
| 34 | |
| 35 | # Path to the base directory of the project. On Windows the binary may |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 36 | # live in project/PCBuild/win32 or project/PCBuild/amd64. |
| 37 | @@ -84,7 +85,9 @@ def get_python_inc(plat_specific=0, prefix=None): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | If 'prefix' is supplied, use it instead of sys.base_prefix or |
| 39 | sys.base_exec_prefix -- i.e., ignore 'plat_specific'. |
| 40 | """ |
| 41 | - if prefix is None: |
| 42 | + if prefix is None and os.environ['STAGING_INCDIR'] != "": |
| 43 | + prefix = os.environ['STAGING_INCDIR'].rstrip('include') |
| 44 | + elif prefix is None: |
| 45 | prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX |
| 46 | if os.name == "posix": |
| 47 | if python_build: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 48 | @@ -125,6 +128,10 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 49 | If 'prefix' is supplied, use it instead of sys.base_prefix or |
| 50 | sys.base_exec_prefix -- i.e., ignore 'plat_specific'. |
| 51 | """ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 52 | + lib_basename = os.environ['STAGING_LIBDIR'].split('/')[-1] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | + if prefix is None and os.environ['STAGING_LIBDIR'] != "": |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 54 | + prefix = os.environ['STAGING_LIBDIR'].rstrip(lib_basename) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | + |
| 56 | if prefix is None: |
| 57 | if standard_lib: |
| 58 | prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 59 | @@ -133,7 +140,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 60 | |
| 61 | if os.name == "posix": |
| 62 | libpython = os.path.join(prefix, |
| 63 | - "lib", "python" + get_python_version()) |
| 64 | + lib_basename, "python" + get_python_version()) |
| 65 | if standard_lib: |
| 66 | return libpython |
| 67 | else: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 68 | @@ -233,7 +240,7 @@ def get_config_h_filename(): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 69 | else: |
| 70 | inc_dir = get_python_inc(plat_specific=1) |
| 71 | |
| 72 | - return os.path.join(inc_dir, 'pyconfig.h') |
| 73 | + return os.path.join(inc_dir, 'pyconfig.h'.replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )) |
| 74 | |
| 75 | |
| 76 | def get_makefile_filename(): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 77 | @@ -242,7 +249,7 @@ def get_makefile_filename(): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 78 | return os.path.join(_sys_home or project_base, "Makefile") |
| 79 | lib_dir = get_python_lib(plat_specific=0, standard_lib=1) |
| 80 | config_file = 'config-{}{}'.format(get_python_version(), build_flags) |
| 81 | - return os.path.join(lib_dir, config_file, 'Makefile') |
| 82 | + return os.path.join(lib_dir, config_file, 'Makefile').replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") ) |
| 83 | |
| 84 | |
| 85 | def parse_config_h(fp, g=None): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 86 | -- |
| 87 | 2.7.0 |
| 88 | |