mirror of https://github.com/python/cpython
gh-90355: Add isolated flag if currently isolated (GH-92857)
Co-authored-by: Éric <merwok@netwok.org> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
067597522a
commit
c8556bcf6c
|
@ -89,8 +89,18 @@ sys.path = {additional_paths or []} + sys.path
|
|||
sys.argv[1:] = {args}
|
||||
runpy.run_module("pip", run_name="__main__", alter_sys=True)
|
||||
"""
|
||||
return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
|
||||
"-c", code], check=True).returncode
|
||||
|
||||
cmd = [
|
||||
sys.executable,
|
||||
'-W',
|
||||
'ignore::DeprecationWarning',
|
||||
'-c',
|
||||
code,
|
||||
]
|
||||
if sys.flags.isolated:
|
||||
# run code in isolated mode if currently running isolated
|
||||
cmd.insert(1, '-I')
|
||||
return subprocess.run(cmd, check=True).returncode
|
||||
|
||||
|
||||
def version():
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix :mod:`ensurepip` environment isolation for subprocess running ``pip``.
|
Loading…
Reference in New Issue