Remove prepended sys.path (#11954)

We prepend the interpreter discovery in a temporary path to `sys.path`,
which we have to strip to avoid the `sys.path` value containing a
then-deleted temp dir.
This commit is contained in:
konsti 2025-03-04 17:00:26 +01:00 committed by GitHub
parent f44aba0a96
commit 12f8d6f2c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -605,7 +605,10 @@ def main() -> None:
"sys_prefix": sys.prefix,
"sys_base_executable": getattr(sys, "_base_executable", None),
"sys_executable": sys.executable,
"sys_path": sys.path,
# We prepend the location with the interpreter discovery script copied to a
# temporary path to `sys.path` so we can import it, which we have to strip later
# to avoid having this now-deleted path around.
"sys_path": sys.path[1:],
"stdlib": sysconfig.get_path("stdlib"),
# Prior to the introduction of `sysconfig` patching, python-build-standalone installations would always use
# "/install" as the prefix. With `sysconfig` patching, we rewrite the prefix to match the actual installation