mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-34011: Fixes missing venv files and other tests (GH-9458)
This commit is contained in:
parent
bc85475058
commit
f14c28f397
8 changed files with 146 additions and 112 deletions
|
@ -208,11 +208,9 @@ class EnvBuilder:
|
|||
copier(context.env_exe, path, relative_symlinks_ok=True)
|
||||
if not os.path.islink(path):
|
||||
os.chmod(path, 0o755)
|
||||
elif sysconfig.is_python_build(True):
|
||||
# See bpo-34011. This copying code should only be needed when a
|
||||
# venv is created from a source Python build (i.e. not an installed
|
||||
# Python)
|
||||
subdir = 'DLLs'
|
||||
else:
|
||||
# See bpo-34011. When using a proper install, we should only need to
|
||||
# copy the top-level of DLLs.
|
||||
include = self.include_binary
|
||||
files = [f for f in os.listdir(dirname) if include(f)]
|
||||
for f in files:
|
||||
|
@ -220,24 +218,28 @@ class EnvBuilder:
|
|||
dst = os.path.join(binpath, f)
|
||||
if dst != context.env_exe: # already done, above
|
||||
copier(src, dst)
|
||||
dirname = os.path.join(dirname, subdir)
|
||||
if os.path.isdir(dirname):
|
||||
files = [f for f in os.listdir(dirname) if include(f)]
|
||||
for f in files:
|
||||
src = os.path.join(dirname, f)
|
||||
dst = os.path.join(binpath, f)
|
||||
copier(src, dst)
|
||||
# copy init.tcl over
|
||||
for root, dirs, files in os.walk(context.python_dir):
|
||||
if 'init.tcl' in files:
|
||||
tcldir = os.path.basename(root)
|
||||
tcldir = os.path.join(context.env_dir, 'Lib', tcldir)
|
||||
if not os.path.exists(tcldir):
|
||||
os.makedirs(tcldir)
|
||||
src = os.path.join(root, 'init.tcl')
|
||||
dst = os.path.join(tcldir, 'init.tcl')
|
||||
shutil.copyfile(src, dst)
|
||||
break
|
||||
|
||||
# When creating from a build directory, we continue to copy all files.
|
||||
if sysconfig.is_python_build(True):
|
||||
subdir = 'DLLs'
|
||||
dirname = os.path.join(dirname, subdir)
|
||||
if os.path.isdir(dirname):
|
||||
files = [f for f in os.listdir(dirname) if include(f)]
|
||||
for f in files:
|
||||
src = os.path.join(dirname, f)
|
||||
dst = os.path.join(binpath, f)
|
||||
copier(src, dst)
|
||||
# copy init.tcl over
|
||||
for root, dirs, files in os.walk(context.python_dir):
|
||||
if 'init.tcl' in files:
|
||||
tcldir = os.path.basename(root)
|
||||
tcldir = os.path.join(context.env_dir, 'Lib', tcldir)
|
||||
if not os.path.exists(tcldir):
|
||||
os.makedirs(tcldir)
|
||||
src = os.path.join(root, 'init.tcl')
|
||||
dst = os.path.join(tcldir, 'init.tcl')
|
||||
shutil.copyfile(src, dst)
|
||||
break
|
||||
|
||||
def _setup_pip(self, context):
|
||||
"""Installs or upgrades pip in a virtual environment"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue