mirror of https://github.com/astral-sh/uv
Add comments to the `with_filtered_python_keys` regex (#12379)
I need to edit this thing and it's a nightmare as written. See https://github.com/astral-sh/uv/pull/12380
This commit is contained in:
parent
f80003a61b
commit
15bf83ced8
|
|
@ -277,11 +277,33 @@ impl TestContext {
|
||||||
/// Adds a filter that ignores platform information in a Python installation key.
|
/// Adds a filter that ignores platform information in a Python installation key.
|
||||||
pub fn with_filtered_python_keys(mut self) -> Self {
|
pub fn with_filtered_python_keys(mut self) -> Self {
|
||||||
// Filter platform keys
|
// Filter platform keys
|
||||||
self.filters.push((
|
let platform_re = r"(?x)
|
||||||
r"((?:cpython|pypy)-\d+\.\d+(?:\.(?:\[X\]|\d+))?[a-z]?(?:\+[a-z]+)?)-[a-z0-9]+-[a-z0-9_]+-[a-z]+"
|
( # We capture the group before the platform
|
||||||
.to_string(),
|
(?:cpython|pypy) # Python implementation
|
||||||
"$1-[PLATFORM]".to_string(),
|
-
|
||||||
));
|
\d+\.\d+ # Major and minor version
|
||||||
|
(?: # The patch version is handled separately
|
||||||
|
\.
|
||||||
|
(?:
|
||||||
|
\[X\] # A previously filtered patch version [X]
|
||||||
|
| # OR
|
||||||
|
\d+ # An actual patch version
|
||||||
|
)
|
||||||
|
)? # (we allow the patch version to be missing entirely, e.g., in a request)
|
||||||
|
[a-z]? # Pre-release letter
|
||||||
|
(?:
|
||||||
|
\+[a-z]+ # An optional variant variant, such as `+free-threaded
|
||||||
|
)?
|
||||||
|
)
|
||||||
|
-
|
||||||
|
[a-z0-9]+ # Operating system (e.g., 'macos')
|
||||||
|
-
|
||||||
|
[a-z0-9_]+ # Architecture (e.g., 'aarch64')
|
||||||
|
-
|
||||||
|
[a-z]+ # Libc (e.g., 'none')
|
||||||
|
";
|
||||||
|
self.filters
|
||||||
|
.push((platform_re.to_string(), "$1-[PLATFORM]".to_string()));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue