98
98
},
99
99
}
100
100
101
+ # GCC[mingw*] use posix build system
102
+ _POSIX_BUILD = os .name == 'posix' or \
103
+ (os .name == "nt" and 'GCC' in sys .version )
104
+
101
105
# For the OS-native venv scheme, we essentially provide an alias:
102
- if os .name == 'nt' :
106
+ if os .name == 'nt' and not _POSIX_BUILD :
103
107
_INSTALL_SCHEMES ['venv' ] = _INSTALL_SCHEMES ['nt_venv' ]
104
108
else :
105
109
_INSTALL_SCHEMES ['venv' ] = _INSTALL_SCHEMES ['posix_venv' ]
106
110
107
111
112
+
108
113
# NOTE: site.py has copy of this function.
109
114
# Sync it when modify this function.
110
115
def _getuserbase ():
@@ -119,7 +124,7 @@ def _getuserbase():
119
124
def joinuser (* args ):
120
125
return os .path .expanduser (os .path .join (* args ))
121
126
122
- if os .name == "nt" :
127
+ if os .name == "nt" and not _POSIX_BUILD :
123
128
base = os .environ .get ("APPDATA" ) or "~"
124
129
return joinuser (base , "Python" )
125
130
@@ -278,7 +283,7 @@ def _expand_vars(scheme, vars):
278
283
279
284
280
285
def _get_preferred_schemes ():
281
- if os .name == 'nt' :
286
+ if os .name == 'nt' and not _POSIX_BUILD :
282
287
return {
283
288
'prefix' : 'nt' ,
284
289
'home' : 'posix_home' ,
@@ -607,7 +612,7 @@ def parse_config_h(fp, vars=None):
607
612
def get_config_h_filename ():
608
613
"""Return the path of pyconfig.h."""
609
614
if _PYTHON_BUILD :
610
- if os .name == "nt" :
615
+ if os .name == "nt" and not _POSIX_BUILD :
611
616
inc_dir = os .path .join (_PROJECT_BASE , "PC" )
612
617
else :
613
618
inc_dir = _PROJECT_BASE
@@ -683,10 +688,10 @@ def get_config_vars(*args):
683
688
except AttributeError :
684
689
_CONFIG_VARS ['py_version_nodot_plat' ] = ''
685
690
686
- if os .name == 'nt' :
691
+ if os .name == 'nt' and not _POSIX_BUILD :
687
692
_init_non_posix (_CONFIG_VARS )
688
693
_CONFIG_VARS ['VPATH' ] = sys ._vpath
689
- if os . name == 'posix' :
694
+ if _POSIX_BUILD :
690
695
_init_posix (_CONFIG_VARS )
691
696
if _HAS_USER_BASE :
692
697
# Setting 'userbase' is done below the call to the
@@ -696,7 +701,7 @@ def get_config_vars(*args):
696
701
697
702
# Always convert srcdir to an absolute path
698
703
srcdir = _CONFIG_VARS .get ('srcdir' , _PROJECT_BASE )
699
- if os . name == 'posix' :
704
+ if _POSIX_BUILD :
700
705
if _PYTHON_BUILD :
701
706
# If srcdir is a relative path (typically '.' or '..')
702
707
# then it should be interpreted relative to the directory
0 commit comments