Skip to content

Commit 15bf83c

Browse files
authored
Add comments to the with_filtered_python_keys regex (#12379)
I need to edit this thing and it's a nightmare as written. See #12380
1 parent f80003a commit 15bf83c

File tree

1 file changed

+27
-5
lines changed
  • crates/uv/tests/it/common

1 file changed

+27
-5
lines changed

crates/uv/tests/it/common/mod.rs

+27-5
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,33 @@ impl TestContext {
277277
/// Adds a filter that ignores platform information in a Python installation key.
278278
pub fn with_filtered_python_keys(mut self) -> Self {
279279
// Filter platform keys
280-
self.filters.push((
281-
r"((?:cpython|pypy)-\d+\.\d+(?:\.(?:\[X\]|\d+))?[a-z]?(?:\+[a-z]+)?)-[a-z0-9]+-[a-z0-9_]+-[a-z]+"
282-
.to_string(),
283-
"$1-[PLATFORM]".to_string(),
284-
));
280+
let platform_re = r"(?x)
281+
( # We capture the group before the platform
282+
(?:cpython|pypy) # Python implementation
283+
-
284+
\d+\.\d+ # Major and minor version
285+
(?: # The patch version is handled separately
286+
\.
287+
(?:
288+
\[X\] # A previously filtered patch version [X]
289+
| # OR
290+
\d+ # An actual patch version
291+
)
292+
)? # (we allow the patch version to be missing entirely, e.g., in a request)
293+
[a-z]? # Pre-release letter
294+
(?:
295+
\+[a-z]+ # An optional variant variant, such as `+free-threaded
296+
)?
297+
)
298+
-
299+
[a-z0-9]+ # Operating system (e.g., 'macos')
300+
-
301+
[a-z0-9_]+ # Architecture (e.g., 'aarch64')
302+
-
303+
[a-z]+ # Libc (e.g., 'none')
304+
";
305+
self.filters
306+
.push((platform_re.to_string(), "$1-[PLATFORM]".to_string()));
285307
self
286308
}
287309

0 commit comments

Comments
 (0)