95
95
_CONFIG_VARS = None
96
96
_USER_BASE = None
97
97
98
+ # GCC[mingw*] use posix build system
99
+ _POSIX_BUILD = os .name == 'posix' or \
100
+ (os .name == "nt" and 'GCC' in sys .version )
98
101
99
102
def _safe_realpath (path ):
100
103
try :
@@ -178,7 +181,7 @@ def _expand_vars(scheme, vars):
178
181
179
182
180
183
def _get_default_scheme ():
181
- if os . name == 'posix' :
184
+ if _POSIX_BUILD :
182
185
# the default scheme for posix is posix_prefix
183
186
return 'posix_prefix'
184
187
return os .name
@@ -190,7 +193,7 @@ def _getuserbase():
190
193
def joinuser (* args ):
191
194
return os .path .expanduser (os .path .join (* args ))
192
195
193
- if os .name == "nt" :
196
+ if os .name == "nt" and not _POSIX_BUILD :
194
197
base = os .environ .get ("APPDATA" ) or "~"
195
198
if env_base :
196
199
return env_base
@@ -475,7 +478,7 @@ def parse_config_h(fp, vars=None):
475
478
def get_config_h_filename ():
476
479
"""Return the path of pyconfig.h."""
477
480
if _PYTHON_BUILD :
478
- if os .name == "nt" :
481
+ if os .name == "nt" and not _POSIX_BUILD :
479
482
inc_dir = os .path .join (_sys_home or _PROJECT_BASE , "PC" )
480
483
else :
481
484
inc_dir = _sys_home or _PROJECT_BASE
@@ -546,9 +549,9 @@ def get_config_vars(*args):
546
549
# sys.abiflags may not be defined on all platforms.
547
550
_CONFIG_VARS ['abiflags' ] = ''
548
551
549
- if os .name == 'nt' :
552
+ if os .name == 'nt' and not _POSIX_BUILD :
550
553
_init_non_posix (_CONFIG_VARS )
551
- if os . name == 'posix' :
554
+ if _POSIX_BUILD :
552
555
_init_posix (_CONFIG_VARS )
553
556
# For backward compatibility, see issue19555
554
557
SO = _CONFIG_VARS .get ('EXT_SUFFIX' )
@@ -561,7 +564,7 @@ def get_config_vars(*args):
561
564
562
565
# Always convert srcdir to an absolute path
563
566
srcdir = _CONFIG_VARS .get ('srcdir' , _PROJECT_BASE )
564
- if os . name == 'posix' :
567
+ if _POSIX_BUILD :
565
568
if _PYTHON_BUILD :
566
569
# If srcdir is a relative path (typically '.' or '..')
567
570
# then it should be interpreted relative to the directory
0 commit comments