blob: d1c92e9eed8764867d762829493a05f09c2f61eb [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From bcddbf40c7f1b80336268cdddacc17369fb0ccea Mon Sep 17 00:00:00 2001
2From: Libin Dang <libin.dang@windriver.com>
3Date: Tue, 11 Apr 2017 14:12:15 +0800
4Subject: [PATCH] Issue #21272: Use _sysconfigdata.py to initialize
5 distutils.sysconfig
6
7Backport upstream commit
8https://github.com/python/cpython/commit/409482251b06fe75c4ee56e85ffbb4b23d934159
9
10Upstream-Status: Backport
11
12Signed-off-by: Li Zhou <li.zhou@windriver.com>
13---
14 Lib/distutils/sysconfig.py | 35 ++++-------------------------------
15 1 file changed, 4 insertions(+), 31 deletions(-)
16
17diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
18index 6d5cfd0..9925d24 100644
19--- a/Lib/distutils/sysconfig.py
20+++ b/Lib/distutils/sysconfig.py
21@@ -424,38 +424,11 @@ _config_vars = None
22
23 def _init_posix():
24 """Initialize the module as appropriate for POSIX systems."""
25- g = {}
26- # load the installed Makefile:
27- try:
28- filename = get_makefile_filename()
29- parse_makefile(filename, g)
30- except OSError as msg:
31- my_msg = "invalid Python installation: unable to open %s" % filename
32- if hasattr(msg, "strerror"):
33- my_msg = my_msg + " (%s)" % msg.strerror
34-
35- raise DistutilsPlatformError(my_msg)
36-
37- # load the installed pyconfig.h:
38- try:
39- filename = get_config_h_filename()
40- with open(filename) as file:
41- parse_config_h(file, g)
42- except OSError as msg:
43- my_msg = "invalid Python installation: unable to open %s" % filename
44- if hasattr(msg, "strerror"):
45- my_msg = my_msg + " (%s)" % msg.strerror
46-
47- raise DistutilsPlatformError(my_msg)
48-
49- # On AIX, there are wrong paths to the linker scripts in the Makefile
50- # -- these paths are relative to the Python source, but when installed
51- # the scripts are in another directory.
52- if python_build:
53- g['LDSHARED'] = g['BLDSHARED']
54-
55+ # _sysconfigdata is generated at build time, see the sysconfig module
56+ from _sysconfigdata import build_time_vars
57 global _config_vars
58- _config_vars = g
59+ _config_vars = {}
60+ _config_vars.update(build_time_vars)
61
62
63 def _init_nt():
64--
651.8.3.1
66