summaryrefslogtreecommitdiff
path: root/meta-freedesktop/recipes-devtools/python/python3/999-distutils-fix-unset-env.patch
blob: ac982693751c8309aec8bd0124cad0fd3cc56685 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
diff -up Python-3.3.2/Lib/distutils/sysconfig.py.build_sys_envs Python-3.3.2/Lib/distutils/sysconfig.py
--- Python-3.3.2/Lib/distutils/sysconfig.py.build_sys_envs	2015-03-03 10:11:38.061996515 +0100
+++ Python-3.3.2/Lib/distutils/sysconfig.py	2015-03-03 10:19:24.947068402 +0100
@@ -15,11 +15,24 @@ import sys
 
 from .errors import DistutilsPlatformError
 
+BUILD_SYS=os.getenv("BUILD_SYS")
+if BUILD_SYS == None:
+    BUILD_SYS=""
+HOST_SYS=os.getenv("HOST_SYS")
+if HOST_SYS == None:
+    HOST_SYS=""
+STAGING_INCDIR=os.getenv("STAGING_INCDIR")
+if STAGING_INCDIR == None:
+    STAGING_INCDIR=""
+STAGING_LIBDIR=os.getenv("STAGING_LIBDIR")
+if STAGING_LIBDIR == None:
+    STAGING_LIBDIR=""
+
 # These are needed in a couple of spots, so just compute them once.
-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") )
-BASE_PREFIX = os.path.normpath(sys.base_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
-BASE_EXEC_PREFIX= os.path.normpath(sys.base_exec_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
+PREFIX = os.path.normpath(sys.prefix).replace(BUILD_SYS, HOST_SYS)
+EXEC_PREFIX = os.path.normpath(sys.exec_prefix).replace( BUILD_SYS, HOST_SYS )
+BASE_PREFIX = os.path.normpath(sys.base_prefix).replace( BUILD_SYS, HOST_SYS )
+BASE_EXEC_PREFIX= os.path.normpath(sys.base_exec_prefix).replace( BUILD_SYS, HOST_SYS )
 
 
 # Path to the base directory of the project. On Windows the binary may
@@ -82,7 +95,6 @@ def get_python_version():
     """
     return sys.version[:3]
 
-
 def get_python_inc(plat_specific=0, prefix=None):
     """Return the directory containing installed Python header files.
 
@@ -94,8 +106,8 @@ def get_python_inc(plat_specific=0, pref
     If 'prefix' is supplied, use it instead of sys.base_prefix or
     sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
     """
-    if prefix is None and os.environ['STAGING_INCDIR'] != "":
-        prefix = os.environ['STAGING_INCDIR'].rstrip('include')
+    if prefix is None and STAGING_INCDIR != "":
+        prefix = STAGING_INCDIR.rstrip('include')
     elif prefix is None:
         prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
     if os.name == "posix":
@@ -124,7 +136,6 @@ def get_python_inc(plat_specific=0, pref
             "I don't know where Python installs its C header files "
             "on platform '%s'" % os.name)
 
-
 def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
     """Return the directory containing the Python library (standard or
     site additions).
@@ -139,9 +150,9 @@ def get_python_lib(plat_specific=0, stan
     If 'prefix' is supplied, use it instead of sys.base_prefix or
     sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
     """
-    if prefix is None and os.environ['STAGING_LIBDIR'] != "":
-        lib_basename = os.environ['STAGING_LIBDIR'].split('/')[-1]
-        prefix = os.environ['STAGING_LIBDIR'].rstrip(lib_basename)
+    if prefix is None and STAGING_LIBDIR != "":
+        lib_basename = STAGING_LIBDIR.split('/')[-1]
+        prefix = STAGING_LIBDIR.rstrip(lib_basename)
     else:
         lib_basename = sys.lib
 
@@ -264,7 +275,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).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
+    return os.path.join(inc_dir, config_h).replace( BUILD_SYS, HOST_SYS )
 
 
 def get_makefile_filename():
@@ -273,7 +284,7 @@ def get_makefile_filename():
         return os.path.join(_sys_home or project_base, "Makefile")
     lib_dir = get_python_lib(plat_specific=0, standard_lib=1)
     config_file = 'config-{}{}'.format(get_python_version(), build_flags)
-    return os.path.join(lib_dir, config_file, 'Makefile').replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
+    return os.path.join(lib_dir, config_file, 'Makefile').replace( BUILD_SYS, HOST_SYS )
 
 
 def parse_config_h(fp, g=None):