MINGW-packages/mingw-w64-python3.13/0086-venv-creation-fixes.patch
Christoph Reiter 04c9ed3700 python3.13: Add 3.13.7
* add libb2 as dep
* remove "-Wl,--large-address-aware", default now via makepkg
* remove 2to3 logic, no longer in Python
2025-09-08 22:02:30 +02:00

52 lines
2.0 KiB
Diff

From 0173dd2f32adff53c583d9b2577ccd1a3372a62f Mon Sep 17 00:00:00 2001
From: Naveen M K <naveen521kk@gmail.com>
Date: Fri, 23 Jun 2023 20:49:15 +0530
Subject: [PATCH 086/N] venv creation fixes
---
Lib/venv/__init__.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
index f7a6d26..c4e441b 100644
--- a/Lib/venv/__init__.py
+++ b/Lib/venv/__init__.py
@@ -13,6 +13,7 @@ import sysconfig
import types
import shlex
+from sysconfig import _POSIX_BUILD
CORE_VENV_DEPS = ('pip',)
logger = logging.getLogger(__name__)
@@ -377,7 +378,7 @@ class EnvBuilder:
}
do_copies = True
- if self.symlinks:
+ if self.symlinks and not _POSIX_BUILD:
do_copies = False
# For symlinking, we need all the DLLs to be available alongside
# the executables.
@@ -413,6 +414,12 @@ class EnvBuilder:
except OSError:
logger.warning('Unable to copy %r to %r', src, dest)
+ if _POSIX_BUILD:
+ # copy from python/pythonw so the venvlauncher magic in symlink_or_copy triggers
+ copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python3.exe'))
+ copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python%d.%d.exe' % sys.version_info[:2]))
+ copier(os.path.join(dirname, 'pythonw.exe'), os.path.join(binpath, 'python3w.exe'))
+
if sysconfig.is_python_build():
# copy init.tcl
for root, dirs, files in os.walk(context.python_dir):
@@ -437,6 +444,7 @@ class EnvBuilder:
env['VIRTUAL_ENV'] = context.env_dir
env.pop('PYTHONHOME', None)
env.pop('PYTHONPATH', None)
+ env.pop("MSYSTEM", None)
kwargs['cwd'] = context.env_dir
kwargs['executable'] = context.env_exec_cmd
subprocess.check_output(args, **kwargs)