aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python-native/12-distutils-prefix-is-inside-staging-area.patch
blob: 8e721fe002a523456e77cdb06774f4aa19acdb55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Upstream-Status: Inappropriate [embedded specific]

# The proper prefix is inside our staging area.
# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>

Index: Python-2.6.6/Lib/distutils/sysconfig.py
===================================================================
--- Python-2.6.6.orig/Lib/distutils/sysconfig.py
+++ Python-2.6.6/Lib/distutils/sysconfig.py
@@ -19,8 +19,8 @@ import sys
 from distutils.errors import DistutilsPlatformError
 
 # These are needed in a couple of spots, so just compute them once.
-PREFIX = os.path.normpath(sys.prefix)
-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+PREFIX = os.path.normpath(sys.prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
+EXEC_PREFIX = os.path.normpath(sys.exec_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
 
 # Path to the base directory of the project. On Windows the binary may
 # live in project/PCBuild9.  If we're dealing with an x64 Windows build,
@@ -70,7 +70,10 @@ def get_python_inc(plat_specific=0, pref
     sys.exec_prefix -- i.e., ignore 'plat_specific'.
     """
     if prefix is None:
-        prefix = plat_specific and EXEC_PREFIX or PREFIX
+        if plat_specific:
+            prefix = plat_specific and os.environ['STAGING_INCDIR'].rstrip('include')
+        else:
+            prefix = plat_specific and EXEC_PREFIX or PREFIX
 
     if os.name == "posix":
         if python_build:
@@ -115,12 +118,16 @@ def get_python_lib(plat_specific=0, stan
     If 'prefix' is supplied, use it instead of sys.prefix or
     sys.exec_prefix -- i.e., ignore 'plat_specific'.
     """
+    lib_basename = os.getenv("libdir").split('/')[-1]
     if prefix is None:
-        prefix = plat_specific and EXEC_PREFIX or PREFIX
+        if plat_specific:
+            prefix = plat_specific and os.environ['STAGING_LIBDIR'].rstrip(lib_basename)
+        else:
+            prefix = plat_specific and EXEC_PREFIX or PREFIX
 
     if os.name == "posix":
         libpython = os.path.join(prefix,
-                                 "lib", "python" + get_python_version())
+                                 lib_basename, "python" + get_python_version())
         if standard_lib:
             return libpython
         else:
@@ -216,7 +223,7 @@ def get_config_h_filename():
     else:
         # The name of the config.h file changed in 2.2
         config_h = 'pyconfig.h'
-    return os.path.join(inc_dir, config_h)
+    return os.path.join(inc_dir, config_h).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
 
 
 def get_makefile_filename():
@@ -225,7 +232,7 @@ def get_makefile_filename():
         return os.path.join(os.path.dirname(os.path.realpath(sys.executable)),
                             "Makefile")
     lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
-    return os.path.join(lib_dir, "config", "Makefile")
+    return os.path.join(lib_dir, "config", "Makefile").replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
 
 
 def parse_config_h(fp, g=None):