summaryrefslogtreecommitdiff
path: root/devel/py-virtualenv/patches/patch-src_virtualenv_create_via__global__ref_api.py
blob: d979e7bfa545bd2beb4c93954accac7bf9fda82a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$NetBSD: patch-src_virtualenv_create_via__global__ref_api.py,v 1.2 2022/09/08 07:46:09 adam Exp $

Copy distutils distro config file to virtualenv.
https://github.com/pypa/virtualenv/issues/2313

--- src/virtualenv/create/via_global_ref/api.py.orig	2022-09-08 02:18:47.000000000 +0000
+++ src/virtualenv/create/via_global_ref/api.py
@@ -2,6 +2,8 @@ import logging
 import os
 from abc import ABCMeta
 from pathlib import Path
+from shutil import copy
+from sysconfig import get_paths
 
 from virtualenv.info import fs_supports_symlink
 
@@ -92,6 +94,10 @@ class ViaGlobalRefApi(Creator, metaclass
             logging.debug("create %s", dest_path)
             dest_path.write_text(text)
 
+        distutils_distro_config = get_paths()["platlib"] + "/_distutils_system_mod.py"
+        if os.path.exists(distutils_distro_config):
+            copy(distutils_distro_config, self.platlib)
+
     def env_patch_text(self):
         """Patch the distutils package to not be derailed by its configuration files"""
         with self.app_data.ensure_extracted(Path(__file__).parent / "_virtualenv.py") as resolved_path: