mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-37369: Fix initialization of sys members when launched via an app container (GH-14428)
sys._base_executable is now always defined on all platforms, and can be overridden through configuration. Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
This commit is contained in:
parent
80097e089b
commit
9048c49322
17 changed files with 410 additions and 277 deletions
|
@ -459,13 +459,6 @@ def venv(known_paths):
|
|||
env = os.environ
|
||||
if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env:
|
||||
executable = sys._base_executable = os.environ['__PYVENV_LAUNCHER__']
|
||||
elif sys.platform == 'win32' and '__PYVENV_LAUNCHER__' in env:
|
||||
executable = sys.executable
|
||||
import _winapi
|
||||
sys._base_executable = _winapi.GetModuleFileName(0)
|
||||
# bpo-35873: Clear the environment variable to avoid it being
|
||||
# inherited by child processes.
|
||||
del os.environ['__PYVENV_LAUNCHER__']
|
||||
else:
|
||||
executable = sys.executable
|
||||
exe_dir, _ = os.path.split(os.path.abspath(executable))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue