mirror of https://github.com/astral-sh/uv
Patch `CC` and `CCX` entries in sysconfig for cross-compiled `aarch64` Python distributions (#12239)
Closes https://github.com/astral-sh/uv/issues/12207
This commit is contained in:
parent
4d34b28657
commit
e58cc39238
|
|
@ -80,6 +80,15 @@ static DEFAULT_VARIABLE_UPDATES: LazyLock<BTreeMap<String, ReplacementEntry>> =
|
|||
to: "cc".to_string(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"CC".to_string(),
|
||||
ReplacementEntry {
|
||||
mode: ReplacementMode::Partial {
|
||||
from: "/usr/bin/aarch64-linux-gnu-gcc".to_string(),
|
||||
},
|
||||
to: "cc".to_string(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"CXX".to_string(),
|
||||
ReplacementEntry {
|
||||
|
|
@ -89,6 +98,15 @@ static DEFAULT_VARIABLE_UPDATES: LazyLock<BTreeMap<String, ReplacementEntry>> =
|
|||
to: "c++".to_string(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"CXX".to_string(),
|
||||
ReplacementEntry {
|
||||
mode: ReplacementMode::Partial {
|
||||
from: "/usr/bin/x86_64-linux-gnu-g++".to_string(),
|
||||
},
|
||||
to: "c++".to_string(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"BLDSHARED".to_string(),
|
||||
ReplacementEntry {
|
||||
|
|
@ -434,15 +452,36 @@ mod tests {
|
|||
let real_prefix = Path::new("/real/prefix");
|
||||
let data = patch_sysconfigdata(sysconfigdata, real_prefix);
|
||||
|
||||
insta::assert_snapshot!(data.to_string_pretty()?, @r###"
|
||||
insta::assert_snapshot!(data.to_string_pretty()?, @r##"
|
||||
# system configuration generated and used by the sysconfig module
|
||||
build_time_vars = {
|
||||
"AR": "ar",
|
||||
"CC": "cc -pthread",
|
||||
"CXX": "c++ -pthread",
|
||||
"CC": "clang -pthread",
|
||||
"CXX": "clang++ -pthread",
|
||||
"PYTHON_BUILD_STANDALONE": 1
|
||||
}
|
||||
"###);
|
||||
"##);
|
||||
|
||||
// Cross-compiles use GNU
|
||||
let sysconfigdata = [
|
||||
("CC", "/usr/bin/aarch64-linux-gnu-gcc"),
|
||||
("CXX", "/usr/bin/x86_64-linux-gnu-g++"),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k.to_string(), Value::String(v.to_string())))
|
||||
.collect::<SysconfigData>();
|
||||
|
||||
let real_prefix = Path::new("/real/prefix");
|
||||
let data = patch_sysconfigdata(sysconfigdata, real_prefix);
|
||||
|
||||
insta::assert_snapshot!(data.to_string_pretty()?, @r##"
|
||||
# system configuration generated and used by the sysconfig module
|
||||
build_time_vars = {
|
||||
"CC": "cc",
|
||||
"CXX": "c++",
|
||||
"PYTHON_BUILD_STANDALONE": 1
|
||||
}
|
||||
"##);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue