Skip to content

Commit 6c7865e

Browse files
committed
feedback: only replace AR for now
1 parent 1d5086c commit 6c7865e

1 file changed

Lines changed: 11 additions & 73 deletions

File tree

  • crates/uv-python/src/sysconfig

crates/uv-python/src/sysconfig/mod.rs

Lines changed: 11 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ mod parser;
4040
/// Replacement mode for sysconfig values.
4141
#[derive(Debug)]
4242
enum ReplacementMode {
43-
Partial { from: String },
4443
Full,
4544
}
4645

@@ -53,13 +52,8 @@ struct ReplacementEntry {
5352

5453
impl ReplacementEntry {
5554
/// Patches a sysconfig value either partially (replacing a specific word) or fully.
56-
fn patch(&self, entry: &str) -> String {
55+
fn patch(&self, _entry: &str) -> String {
5756
match &self.mode {
58-
ReplacementMode::Partial { from } => entry
59-
.split_whitespace()
60-
.map(|word| if word == from { &self.to } else { word })
61-
.collect::<Vec<_>>()
62-
.join(" "),
6357
ReplacementMode::Full => self.to.clone(),
6458
}
6559
}
@@ -68,69 +62,13 @@ impl ReplacementEntry {
6862
/// Mapping for sysconfig keys to lookup and replace with the appropriate entry.
6963
static DEFAULT_VARIABLE_UPDATES: LazyLock<BTreeMap<String, ReplacementEntry>> =
7064
LazyLock::new(|| {
71-
BTreeMap::from_iter([
72-
(
73-
"CC".to_string(),
74-
ReplacementEntry {
75-
mode: ReplacementMode::Partial {
76-
from: "clang".to_string(),
77-
},
78-
to: "cc".to_string(),
79-
},
80-
),
81-
(
82-
"CXX".to_string(),
83-
ReplacementEntry {
84-
mode: ReplacementMode::Partial {
85-
from: "clang++".to_string(),
86-
},
87-
to: "c++".to_string(),
88-
},
89-
),
90-
(
91-
"BLDSHARED".to_string(),
92-
ReplacementEntry {
93-
mode: ReplacementMode::Partial {
94-
from: "clang".to_string(),
95-
},
96-
to: "cc".to_string(),
97-
},
98-
),
99-
(
100-
"LDSHARED".to_string(),
101-
ReplacementEntry {
102-
mode: ReplacementMode::Partial {
103-
from: "clang".to_string(),
104-
},
105-
to: "cc".to_string(),
106-
},
107-
),
108-
(
109-
"LDCXXSHARED".to_string(),
110-
ReplacementEntry {
111-
mode: ReplacementMode::Partial {
112-
from: "clang++".to_string(),
113-
},
114-
to: "c++".to_string(),
115-
},
116-
),
117-
(
118-
"LINKCC".to_string(),
119-
ReplacementEntry {
120-
mode: ReplacementMode::Partial {
121-
from: "clang".to_string(),
122-
},
123-
to: "cc".to_string(),
124-
},
125-
),
126-
(
127-
"AR".to_string(),
128-
ReplacementEntry {
129-
mode: ReplacementMode::Full,
130-
to: "ar".to_string(),
131-
},
132-
),
133-
])
65+
BTreeMap::from_iter([(
66+
"AR".to_string(),
67+
ReplacementEntry {
68+
mode: ReplacementMode::Full,
69+
to: "ar".to_string(),
70+
},
71+
)])
13472
});
13573

13674
/// Update the `sysconfig` data in a Python installation.
@@ -354,8 +292,8 @@ mod tests {
354292
# system configuration generated and used by the sysconfig module
355293
build_time_vars = {
356294
"AR": "ar",
357-
"CC": "cc -pthread",
358-
"CXX": "c++ -pthread",
295+
"CC": "clang -pthread",
296+
"CXX": "clang++ -pthread",
359297
"PYTHON_BUILD_STANDALONE": 1
360298
}
361299
"###);
@@ -378,7 +316,7 @@ mod tests {
378316
insta::assert_snapshot!(data.to_string_pretty()?, @r###"
379317
# system configuration generated and used by the sysconfig module
380318
build_time_vars = {
381-
"BLDSHARED": "cc -bundle -undefined dynamic_lookup -arch arm64",
319+
"BLDSHARED": "clang -bundle -undefined dynamic_lookup -arch arm64",
382320
"PYTHON_BUILD_STANDALONE": 1
383321
}
384322
"###);

0 commit comments

Comments
 (0)