@@ -86,6 +86,9 @@ def get_platform():
86
86
MACOS = (HOST_PLATFORM == 'darwin' )
87
87
AIX = (HOST_PLATFORM .startswith ('aix' ))
88
88
VXWORKS = ('vxworks' in HOST_PLATFORM )
89
+ CC = os .environ .get ("CC" )
90
+ if not CC :
91
+ CC = sysconfig .get_config_var ("CC" )
89
92
90
93
91
94
SUMMARY = """
@@ -467,6 +470,9 @@ def set_compiler_executables(self):
467
470
468
471
def build_extensions (self ):
469
472
self .set_srcdir ()
473
+ self .set_compiler_executables ()
474
+ self .configure_compiler ()
475
+ self .init_inc_lib_dirs ()
470
476
471
477
# Detect which modules should be compiled
472
478
self .detect_modules ()
@@ -476,7 +482,6 @@ def build_extensions(self):
476
482
477
483
self .update_sources_depends ()
478
484
mods_built , mods_disabled = self .remove_configured_extensions ()
479
- self .set_compiler_executables ()
480
485
481
486
if LIST_MODULE_NAMES :
482
487
for ext in self .extensions :
@@ -662,12 +667,11 @@ def check_extension_import(self, ext):
662
667
def add_multiarch_paths (self ):
663
668
# Debian/Ubuntu multiarch support.
664
669
# https://wiki.ubuntu.com/MultiarchSpec
665
- cc = sysconfig .get_config_var ('CC' )
666
670
tmpfile = os .path .join (self .build_temp , 'multiarch' )
667
671
if not os .path .exists (self .build_temp ):
668
672
os .makedirs (self .build_temp )
669
673
ret = run_command (
670
- '%s -print-multiarch > %s 2> /dev/null' % (cc , tmpfile ))
674
+ '%s -print-multiarch > %s 2> /dev/null' % (CC , tmpfile ))
671
675
multiarch_path_component = ''
672
676
try :
673
677
if ret == 0 :
@@ -729,11 +733,10 @@ def add_search_path(line):
729
733
d = os .path .normpath (d )
730
734
add_dir_to_list (self .compiler .library_dirs , d )
731
735
732
- cc = sysconfig .get_config_var ('CC' )
733
736
tmpfile = os .path .join (self .build_temp , 'wrccpaths' )
734
737
os .makedirs (self .build_temp , exist_ok = True )
735
738
try :
736
- ret = run_command ('%s --print-search-dirs >%s' % (cc , tmpfile ))
739
+ ret = run_command ('%s --print-search-dirs >%s' % (CC , tmpfile ))
737
740
if ret :
738
741
return
739
742
with open (tmpfile ) as fp :
@@ -751,11 +754,10 @@ def add_search_path(line):
751
754
pass
752
755
753
756
def add_cross_compiling_paths (self ):
754
- cc = sysconfig .get_config_var ('CC' )
755
757
tmpfile = os .path .join (self .build_temp , 'ccpaths' )
756
758
if not os .path .exists (self .build_temp ):
757
759
os .makedirs (self .build_temp )
758
- ret = run_command ('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc , tmpfile ))
760
+ ret = run_command ('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC , tmpfile ))
759
761
is_gcc = False
760
762
is_clang = False
761
763
in_incdirs = False
@@ -1876,9 +1878,6 @@ def detect_uuid(self):
1876
1878
self .missing .append ('_uuid' )
1877
1879
1878
1880
def detect_modules (self ):
1879
- self .configure_compiler ()
1880
- self .init_inc_lib_dirs ()
1881
-
1882
1881
self .detect_simple_extensions ()
1883
1882
if TEST_EXTENSIONS :
1884
1883
self .detect_test_extensions ()
0 commit comments