@@ -84,6 +84,9 @@ def get_platform():
84
84
MACOS = (HOST_PLATFORM == 'darwin' )
85
85
AIX = (HOST_PLATFORM .startswith ('aix' ))
86
86
VXWORKS = ('vxworks' in HOST_PLATFORM )
87
+ CC = os .environ .get ("CC" )
88
+ if not CC :
89
+ CC = sysconfig .get_config_var ("CC" )
87
90
88
91
89
92
SUMMARY = """
@@ -556,6 +559,9 @@ def set_compiler_executables(self):
556
559
557
560
def build_extensions (self ):
558
561
self .set_srcdir ()
562
+ self .set_compiler_executables ()
563
+ self .configure_compiler ()
564
+ self .init_inc_lib_dirs ()
559
565
560
566
# Detect which modules should be compiled
561
567
self .detect_modules ()
@@ -565,7 +571,6 @@ def build_extensions(self):
565
571
566
572
self .update_sources_depends ()
567
573
mods_built , mods_disabled = self .handle_configured_extensions ()
568
- self .set_compiler_executables ()
569
574
570
575
if LIST_MODULE_NAMES :
571
576
for ext in self .extensions :
@@ -751,12 +756,11 @@ def check_extension_import(self, ext):
751
756
def add_multiarch_paths (self ):
752
757
# Debian/Ubuntu multiarch support.
753
758
# https://wiki.ubuntu.com/MultiarchSpec
754
- cc = sysconfig .get_config_var ('CC' )
755
759
tmpfile = os .path .join (self .build_temp , 'multiarch' )
756
760
if not os .path .exists (self .build_temp ):
757
761
os .makedirs (self .build_temp )
758
762
ret = run_command (
759
- '%s -print-multiarch > %s 2> /dev/null' % (cc , tmpfile ))
763
+ '%s -print-multiarch > %s 2> /dev/null' % (CC , tmpfile ))
760
764
multiarch_path_component = ''
761
765
try :
762
766
if ret == 0 :
@@ -818,11 +822,10 @@ def add_search_path(line):
818
822
d = os .path .normpath (d )
819
823
add_dir_to_list (self .compiler .library_dirs , d )
820
824
821
- cc = sysconfig .get_config_var ('CC' )
822
825
tmpfile = os .path .join (self .build_temp , 'wrccpaths' )
823
826
os .makedirs (self .build_temp , exist_ok = True )
824
827
try :
825
- ret = run_command ('%s --print-search-dirs >%s' % (cc , tmpfile ))
828
+ ret = run_command ('%s --print-search-dirs >%s' % (CC , tmpfile ))
826
829
if ret :
827
830
return
828
831
with open (tmpfile ) as fp :
@@ -840,11 +843,10 @@ def add_search_path(line):
840
843
pass
841
844
842
845
def add_cross_compiling_paths (self ):
843
- cc = sysconfig .get_config_var ('CC' )
844
846
tmpfile = os .path .join (self .build_temp , 'ccpaths' )
845
847
if not os .path .exists (self .build_temp ):
846
848
os .makedirs (self .build_temp )
847
- ret = run_command ('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc , tmpfile ))
849
+ ret = run_command ('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC , tmpfile ))
848
850
is_gcc = False
849
851
is_clang = False
850
852
in_incdirs = False
@@ -1407,9 +1409,6 @@ def detect_modules(self):
1407
1409
# remove dummy extension
1408
1410
self .extensions = []
1409
1411
1410
- self .configure_compiler ()
1411
- self .init_inc_lib_dirs ()
1412
-
1413
1412
# Some C extensions are built by entries in Modules/Setup.bootstrap.
1414
1413
# These are extensions are required to bootstrap the interpreter or
1415
1414
# build process.
0 commit comments