[3.9] bpo-45881: Use CC from env first for cross building (GH-29752) (GH-29754) by tiran · Pull Request #29754 · python/cpython
Expand Up
@@ -65,6 +65,9 @@ def get_platform():
MACOS = (HOST_PLATFORM == 'darwin')
AIX = (HOST_PLATFORM.startswith('aix'))
VXWORKS = ('vxworks' in HOST_PLATFORM)
CC = os.environ.get("CC")
if not CC:
CC = sysconfig.get_config_var("CC")
SUMMARY = """ Expand Down Expand Up @@ -443,6 +446,9 @@ def set_compiler_executables(self):
def build_extensions(self): self.set_srcdir() self.set_compiler_executables() self.configure_compiler() self.init_inc_lib_dirs()
# Detect which modules should be compiled self.detect_modules() Expand All @@ -451,7 +457,6 @@ def build_extensions(self):
self.update_sources_depends() mods_built, mods_disabled = self.remove_configured_extensions() self.set_compiler_executables()
build_ext.build_extensions(self)
Expand Down Expand Up @@ -631,12 +636,11 @@ def check_extension_import(self, ext): def add_multiarch_paths(self): # Debian/Ubuntu multiarch support. # https://wiki.ubuntu.com/MultiarchSpec cc = sysconfig.get_config_var('CC') tmpfile = os.path.join(self.build_temp, 'multiarch') if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) ret = run_command( '%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile)) '%s -print-multiarch > %s 2> /dev/null' % (CC, tmpfile)) multiarch_path_component = '' try: if ret == 0: Expand Down Expand Up @@ -675,11 +679,10 @@ def add_multiarch_paths(self): os.unlink(tmpfile)
def add_cross_compiling_paths(self): cc = sysconfig.get_config_var('CC') tmpfile = os.path.join(self.build_temp, 'ccpaths') if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc, tmpfile)) ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile)) is_gcc = False is_clang = False in_incdirs = False Expand Down Expand Up @@ -1783,9 +1786,6 @@ def detect_uuid(self): self.missing.append('_uuid')
def detect_modules(self): self.configure_compiler() self.init_inc_lib_dirs()
self.detect_simple_extensions() if TEST_EXTENSIONS: self.detect_test_extensions() Expand Down
SUMMARY = """ Expand Down Expand Up @@ -443,6 +446,9 @@ def set_compiler_executables(self):
def build_extensions(self): self.set_srcdir() self.set_compiler_executables() self.configure_compiler() self.init_inc_lib_dirs()
# Detect which modules should be compiled self.detect_modules() Expand All @@ -451,7 +457,6 @@ def build_extensions(self):
self.update_sources_depends() mods_built, mods_disabled = self.remove_configured_extensions() self.set_compiler_executables()
build_ext.build_extensions(self)
Expand Down Expand Up @@ -631,12 +636,11 @@ def check_extension_import(self, ext): def add_multiarch_paths(self): # Debian/Ubuntu multiarch support. # https://wiki.ubuntu.com/MultiarchSpec cc = sysconfig.get_config_var('CC') tmpfile = os.path.join(self.build_temp, 'multiarch') if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) ret = run_command( '%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile)) '%s -print-multiarch > %s 2> /dev/null' % (CC, tmpfile)) multiarch_path_component = '' try: if ret == 0: Expand Down Expand Up @@ -675,11 +679,10 @@ def add_multiarch_paths(self): os.unlink(tmpfile)
def add_cross_compiling_paths(self): cc = sysconfig.get_config_var('CC') tmpfile = os.path.join(self.build_temp, 'ccpaths') if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc, tmpfile)) ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile)) is_gcc = False is_clang = False in_incdirs = False Expand Down Expand Up @@ -1783,9 +1786,6 @@ def detect_uuid(self): self.missing.append('_uuid')
def detect_modules(self): self.configure_compiler() self.init_inc_lib_dirs()
self.detect_simple_extensions() if TEST_EXTENSIONS: self.detect_test_extensions() Expand Down