Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions crates/uv-python/src/sysconfig/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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",
Comment on lines -441 to +460
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, it's wrong in the snapshot even.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, it's a BTreeMap

Copy link
Collaborator

@samypr100 samypr100 Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅 Sorry, I didn't think about the multi-arch scenario originally

"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(())
}
Expand Down
Loading