11
11
import sys
12
12
import sysconfig
13
13
import types
14
-
14
+ from sysconfig import _POSIX_BUILD
15
15
16
16
CORE_VENV_DEPS = ('pip' , 'setuptools' )
17
17
logger = logging .getLogger (__name__ )
@@ -301,7 +301,7 @@ def setup_python(self, context):
301
301
if not os .path .islink (path ):
302
302
os .chmod (path , 0o755 )
303
303
else :
304
- if self .symlinks :
304
+ if self .symlinks and not _POSIX_BUILD :
305
305
# For symlinking, we need a complete copy of the root directory
306
306
# If symlinks fail, you'll get unnecessary copies of files, but
307
307
# we assume that if you've opted into symlinks on Windows then
@@ -325,6 +325,12 @@ def setup_python(self, context):
325
325
if os .path .lexists (src ):
326
326
copier (src , os .path .join (binpath , suffix ))
327
327
328
+ if _POSIX_BUILD :
329
+ # copy from python/pythonw so the venvlauncher magic in symlink_or_copy triggers
330
+ copier (os .path .join (dirname , 'python.exe' ), os .path .join (binpath , 'python3.exe' ))
331
+ copier (os .path .join (dirname , 'python.exe' ), os .path .join (binpath , 'python%d.%d.exe' % sys .version_info [:2 ]))
332
+ copier (os .path .join (dirname , 'pythonw.exe' ), os .path .join (binpath , 'python3w.exe' ))
333
+
328
334
if sysconfig .is_python_build ():
329
335
# copy init.tcl
330
336
for root , dirs , files in os .walk (context .python_dir ):
@@ -349,6 +355,7 @@ def _call_new_python(self, context, *py_args, **kwargs):
349
355
env ['VIRTUAL_ENV' ] = context .env_dir
350
356
env .pop ('PYTHONHOME' , None )
351
357
env .pop ('PYTHONPATH' , None )
358
+ env .pop ("MSYSTEM" , None )
352
359
kwargs ['cwd' ] = context .env_dir
353
360
kwargs ['executable' ] = context .env_exec_cmd
354
361
subprocess .check_output (args , ** kwargs )
0 commit comments