mirror of
https://github.com/python/cpython.git
synced 2025-11-08 17:41:42 +00:00
gh-133951: Remove lib64->lib symlink in venv creation (#137139)
* Remove lib64->lib symlink in venv directory * fix test * remove unused import * add news
This commit is contained in:
parent
8d17d79299
commit
a7a485558c
3 changed files with 7 additions and 14 deletions
|
|
@ -12,7 +12,6 @@
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import struct
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import sysconfig
|
import sysconfig
|
||||||
|
|
@ -138,14 +137,9 @@ def _check_output_of_default_create(self):
|
||||||
self.isdir(self.bindir)
|
self.isdir(self.bindir)
|
||||||
self.isdir(self.include)
|
self.isdir(self.include)
|
||||||
self.isdir(*self.lib)
|
self.isdir(*self.lib)
|
||||||
# Issue 21197
|
|
||||||
p = self.get_env_file('lib64')
|
p = self.get_env_file('lib64')
|
||||||
conditions = ((struct.calcsize('P') == 8) and (os.name == 'posix') and
|
if os.path.exists(p):
|
||||||
(sys.platform != 'darwin'))
|
self.assertFalse(os.path.islink(p))
|
||||||
if conditions:
|
|
||||||
self.assertTrue(os.path.islink(p))
|
|
||||||
else:
|
|
||||||
self.assertFalse(os.path.exists(p))
|
|
||||||
data = self.get_text_file_contents('pyvenv.cfg')
|
data = self.get_text_file_contents('pyvenv.cfg')
|
||||||
executable = sys._base_executable
|
executable = sys._base_executable
|
||||||
path = os.path.dirname(executable)
|
path = os.path.dirname(executable)
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ def create_if_needed(d):
|
||||||
context.python_exe = exename
|
context.python_exe = exename
|
||||||
binpath = self._venv_path(env_dir, 'scripts')
|
binpath = self._venv_path(env_dir, 'scripts')
|
||||||
libpath = self._venv_path(env_dir, 'purelib')
|
libpath = self._venv_path(env_dir, 'purelib')
|
||||||
|
platlibpath = self._venv_path(env_dir, 'platlib')
|
||||||
|
|
||||||
# PEP 405 says venvs should create a local include directory.
|
# PEP 405 says venvs should create a local include directory.
|
||||||
# See https://peps.python.org/pep-0405/#include-files
|
# See https://peps.python.org/pep-0405/#include-files
|
||||||
|
|
@ -191,12 +192,8 @@ def create_if_needed(d):
|
||||||
create_if_needed(incpath)
|
create_if_needed(incpath)
|
||||||
context.lib_path = libpath
|
context.lib_path = libpath
|
||||||
create_if_needed(libpath)
|
create_if_needed(libpath)
|
||||||
# Issue 21197: create lib64 as a symlink to lib on 64-bit non-OS X POSIX
|
context.platlib_path = platlibpath
|
||||||
if ((sys.maxsize > 2**32) and (os.name == 'posix') and
|
create_if_needed(platlibpath)
|
||||||
(sys.platform != 'darwin')):
|
|
||||||
link_path = os.path.join(env_dir, 'lib64')
|
|
||||||
if not os.path.exists(link_path): # Issue #21643
|
|
||||||
os.symlink('lib', link_path)
|
|
||||||
context.bin_path = binpath
|
context.bin_path = binpath
|
||||||
context.bin_name = os.path.relpath(binpath, env_dir)
|
context.bin_name = os.path.relpath(binpath, env_dir)
|
||||||
context.env_exe = os.path.join(binpath, exename)
|
context.env_exe = os.path.join(binpath, exename)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
Remove lib64-lib symlink creation when creating new virtual environments in
|
||||||
|
:mod:`venv` module
|
||||||
Loading…
Add table
Add a link
Reference in a new issue