Patch sysconfig data at install time (#9857)
## Summary This PR reimplements [`sysconfigpatcher`](https://github.com/bluss/sysconfigpatcher) in Rust and applies it to our Python installations at install-time, ensuring that the `sysconfig` data is more likely to be correct. For now, we only rewrite prefixes (i.e., any path that starts with `/install` gets rewritten to the correct absolute path for the current machine). Unlike `sysconfigpatcher`, this PR does not yet do any of the following: - Patch `pkginfo` files. - Change `clang` references to `cc`. A few things that we should do as follow-ups, in my opinion: 1. Rewrite [`AR`](https://github.com/bluss/sysconfigpatcher/blob/c1ebf8ab9274dcde255484d93ce0f1fd1f76a248/src/sysconfigpatcher.py#L61). 2. Remove `-isysroot`, which we already do for newer builds.
This commit is contained in:
@@ -573,7 +573,10 @@ def main() -> None:
|
||||
"sys_executable": sys.executable,
|
||||
"sys_path": sys.path,
|
||||
"stdlib": sysconfig.get_path("stdlib"),
|
||||
"sysconfig_prefix": sysconfig.get_config_var("prefix"),
|
||||
# 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
|
||||
# location. So in newer versions, we also write a dedicated flag to indicate standalone builds.
|
||||
"standalone": sysconfig.get_config_var("prefix") == "/install" or bool(sysconfig.get_config_var("PYTHON_BUILD_STANDALONE")),
|
||||
"scheme": get_scheme(),
|
||||
"virtualenv": get_virtualenv(),
|
||||
"platform": os_and_arch,
|
||||
|
||||
Reference in New Issue
Block a user