blob: 8b93c1cf4f1241da80696b190604f7d078a15f04 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001From d4dd67daa1555bf13272cc071706338572539bad Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 14 May 2013 15:00:26 -0700
4Subject: [PATCH 01/20] python3: Add target and native recipes
5
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006Upstream-Status: Inappropriate [embedded specific]
7
802/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 Williamsd8c66bc2016-06-20 12:57:21 -050016---
17diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
18index 573724d..418b478 100644
19--- a/Lib/distutils/sysconfig.py
20+++ b/Lib/distutils/sysconfig.py
21@@ -17,10 +17,11 @@ import sys
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 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 Williamsd8c66bc2016-06-20 12:57:21 -050036 # live in project/PCBuild/win32 or project/PCBuild/amd64.
37@@ -84,7 +85,9 @@ def get_python_inc(plat_specific=0, prefix=None):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 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 Williamsd8c66bc2016-06-20 12:57:21 -050048@@ -125,6 +128,10 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049 If 'prefix' is supplied, use it instead of sys.base_prefix or
50 sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
51 """
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050052+ lib_basename = os.environ['STAGING_LIBDIR'].split('/')[-1]
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053+ if prefix is None and os.environ['STAGING_LIBDIR'] != "":
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054+ prefix = os.environ['STAGING_LIBDIR'].rstrip(lib_basename)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055+
56 if prefix is None:
57 if standard_lib:
58 prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050059@@ -133,7 +140,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060
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 Williamsd8c66bc2016-06-20 12:57:21 -050068@@ -233,7 +240,7 @@ def get_config_h_filename():
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069 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 Williamsd8c66bc2016-06-20 12:57:21 -050077@@ -242,7 +249,7 @@ def get_makefile_filename():
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078 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 Williamsd8c66bc2016-06-20 12:57:21 -050086--
872.7.0
88