mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-01 20:31:12 +00:00
Normalize platform_system to sys_platform (#9949)
## Summary A revival of an old idea (#9344) that I have slightly more confidence in now. I abandoned this idea because (1) it couldn't capture that, e.g., `platform_system == 'Windows' and sys_platform == 'foo'` (or some other unknown value) are disjoint, and (2) I thought that Android returned `"android"` for one of `sys_platform` or `platform_system`, which would've made this logic incorrect. However, it looks like Android... doesn't do that? And the values here are almost always in a small, known set. So in the end, the tradeoffs here actually seem pretty good. Vis-a-vis our current solution, this can (e.g.) _simplify out_ expressions like `sys_platform == 'win32' or platform_system == 'Windows'`.
This commit is contained in:
parent
eb6bf8b0ee
commit
dd760ee507
16 changed files with 267 additions and 292 deletions
|
|
@ -60,24 +60,15 @@ mod tree;
|
|||
pub const VERSION: u32 = 1;
|
||||
|
||||
static LINUX_MARKERS: LazyLock<UniversalMarker> = LazyLock::new(|| {
|
||||
let pep508 = MarkerTree::from_str(
|
||||
"platform_system == 'Linux' and os_name == 'posix' and sys_platform == 'linux'",
|
||||
)
|
||||
.unwrap();
|
||||
let pep508 = MarkerTree::from_str("os_name == 'posix' and sys_platform == 'linux'").unwrap();
|
||||
UniversalMarker::new(pep508, ConflictMarker::TRUE)
|
||||
});
|
||||
static WINDOWS_MARKERS: LazyLock<UniversalMarker> = LazyLock::new(|| {
|
||||
let pep508 = MarkerTree::from_str(
|
||||
"platform_system == 'Windows' and os_name == 'nt' and sys_platform == 'win32'",
|
||||
)
|
||||
.unwrap();
|
||||
let pep508 = MarkerTree::from_str("os_name == 'nt' and sys_platform == 'win32'").unwrap();
|
||||
UniversalMarker::new(pep508, ConflictMarker::TRUE)
|
||||
});
|
||||
static MAC_MARKERS: LazyLock<UniversalMarker> = LazyLock::new(|| {
|
||||
let pep508 = MarkerTree::from_str(
|
||||
"platform_system == 'Darwin' and os_name == 'posix' and sys_platform == 'darwin'",
|
||||
)
|
||||
.unwrap();
|
||||
let pep508 = MarkerTree::from_str("os_name == 'posix' and sys_platform == 'darwin'").unwrap();
|
||||
UniversalMarker::new(pep508, ConflictMarker::TRUE)
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue