@@ -65,6 +65,9 @@ def get_platform():
65
65
MACOS = (HOST_PLATFORM == 'darwin' )
66
66
AIX = (HOST_PLATFORM .startswith ('aix' ))
67
67
VXWORKS = ('vxworks' in HOST_PLATFORM )
68
+ CC = os .environ .get ("CC" )
69
+ if not CC :
70
+ CC = sysconfig .get_config_var ("CC" )
68
71
69
72
70
73
SUMMARY = """
@@ -443,6 +446,9 @@ def set_compiler_executables(self):
443
446
444
447
def build_extensions (self ):
445
448
self .set_srcdir ()
449
+ self .set_compiler_executables ()
450
+ self .configure_compiler ()
451
+ self .init_inc_lib_dirs ()
446
452
447
453
# Detect which modules should be compiled
448
454
self .detect_modules ()
@@ -451,7 +457,6 @@ def build_extensions(self):
451
457
452
458
self .update_sources_depends ()
453
459
mods_built , mods_disabled = self .remove_configured_extensions ()
454
- self .set_compiler_executables ()
455
460
456
461
build_ext .build_extensions (self )
457
462
@@ -631,12 +636,11 @@ def check_extension_import(self, ext):
631
636
def add_multiarch_paths (self ):
632
637
# Debian/Ubuntu multiarch support.
633
638
# https://wiki.ubuntu.com/MultiarchSpec
634
- cc = sysconfig .get_config_var ('CC' )
635
639
tmpfile = os .path .join (self .build_temp , 'multiarch' )
636
640
if not os .path .exists (self .build_temp ):
637
641
os .makedirs (self .build_temp )
638
642
ret = run_command (
639
- '%s -print-multiarch > %s 2> /dev/null' % (cc , tmpfile ))
643
+ '%s -print-multiarch > %s 2> /dev/null' % (CC , tmpfile ))
640
644
multiarch_path_component = ''
641
645
try :
642
646
if ret == 0 :
@@ -675,11 +679,10 @@ def add_multiarch_paths(self):
675
679
os .unlink (tmpfile )
676
680
677
681
def add_cross_compiling_paths (self ):
678
- cc = sysconfig .get_config_var ('CC' )
679
682
tmpfile = os .path .join (self .build_temp , 'ccpaths' )
680
683
if not os .path .exists (self .build_temp ):
681
684
os .makedirs (self .build_temp )
682
- ret = run_command ('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc , tmpfile ))
685
+ ret = run_command ('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC , tmpfile ))
683
686
is_gcc = False
684
687
is_clang = False
685
688
in_incdirs = False
@@ -1783,9 +1786,6 @@ def detect_uuid(self):
1783
1786
self .missing .append ('_uuid' )
1784
1787
1785
1788
def detect_modules (self ):
1786
- self .configure_compiler ()
1787
- self .init_inc_lib_dirs ()
1788
-
1789
1789
self .detect_simple_extensions ()
1790
1790
if TEST_EXTENSIONS :
1791
1791
self .detect_test_extensions ()
0 commit comments