Fix implied `platform_machine` marker for `win_arm64` platform tag (#15921)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

I'm back again after #14041, this time for `win_arm64`. I [asked a
Windows on ARM
user](https://github.com/getlogbook/logbook/pull/451#issuecomment-3295513650)
what the value of `platform.machine()` is, and it's `ARM64`.

## Test Plan

Updated/added tests
This commit is contained in:
Frazer McLean 2025-09-18 01:33:59 +02:00 committed by GitHub
parent c4c47814a8
commit f122387f89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 79 additions and 2 deletions

View File

@ -860,7 +860,7 @@ fn implied_platform_markers(filename: &WheelFilename) -> MarkerTree {
tag_marker.and(MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::PlatformMachine,
operator: MarkerOperator::Equal,
value: arcstr::literal!("arm64"),
value: arcstr::literal!("ARM64"),
}));
marker.or(tag_marker);
}
@ -1051,7 +1051,7 @@ mod tests {
);
assert_platform_markers(
"numpy-2.2.1-cp313-cp313t-win_arm64.whl",
"sys_platform == 'win32' and platform_machine == 'arm64'",
"sys_platform == 'win32' and platform_machine == 'ARM64'",
);
assert_platform_markers(
"numpy-2.2.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
@ -1128,6 +1128,10 @@ mod tests {
"numpy-1.0-cp310-cp310-win32.whl",
"python_full_version == '3.10.*' and platform_python_implementation == 'CPython' and sys_platform == 'win32' and platform_machine == 'x86'",
);
assert_implied_markers(
"pywin32-311-cp314-cp314-win_arm64.whl",
"python_full_version == '3.14.*' and platform_python_implementation == 'CPython' and sys_platform == 'win32' and platform_machine == 'ARM64'",
);
assert_implied_markers(
"numpy-1.0-cp311-cp311-macosx_10_9_x86_64.whl",
"python_full_version == '3.11.*' and platform_python_implementation == 'CPython' and sys_platform == 'darwin' and platform_machine == 'x86_64'",

View File

@ -29504,6 +29504,79 @@ fn windows_amd64_required() -> Result<()> {
Ok(())
}
#[test]
fn windows_arm64_required() -> Result<()> {
let context = TestContext::new("3.12").with_exclude_newer("2025-01-30T00:00:00Z");
let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(
r#"
[project]
name = "pywin32-prj"
version = "0.1.0"
requires-python = "~=3.12.0"
dependencies = ["pywin32; sys_platform == 'win32'"]
[tool.uv]
required-environments = [
"sys_platform == 'win32' and platform_machine == 'ARM64'",
]
"#,
)?;
uv_snapshot!(context.filters(), context.lock(), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 2 packages in [TIME]
"###);
let lock = context.read("uv.lock");
insta::with_settings!({
filters => context.filters(),
}, {
assert_snapshot!(
lock, @r#"
version = 1
revision = 3
requires-python = "==3.12.*"
required-markers = [
"platform_machine == 'ARM64' and sys_platform == 'win32'",
]
[options]
exclude-newer = "2025-01-30T00:00:00Z"
[[package]]
name = "pywin32"
version = "308"
source = { registry = "https://pypi.org/simple" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/00/7c/d00d6bdd96de4344e06c4afbf218bc86b54436a94c01c71a8701f613aa56/pywin32-308-cp312-cp312-win32.whl", hash = "sha256:587f3e19696f4bf96fde9d8a57cec74a57021ad5f204c9e627e15c33ff568897", size = 5939729, upload-time = "2024-10-12T20:42:12.001Z" },
{ url = "https://files.pythonhosted.org/packages/21/27/0c8811fbc3ca188f93b5354e7c286eb91f80a53afa4e11007ef661afa746/pywin32-308-cp312-cp312-win_amd64.whl", hash = "sha256:00b3e11ef09ede56c6a43c71f2d31857cf7c54b0ab6e78ac659497abd2834f47", size = 6543015, upload-time = "2024-10-12T20:42:14.044Z" },
{ url = "https://files.pythonhosted.org/packages/9d/0f/d40f8373608caed2255781a3ad9a51d03a594a1248cd632d6a298daca693/pywin32-308-cp312-cp312-win_arm64.whl", hash = "sha256:9b4de86c8d909aed15b7011182c8cab38c8850de36e6afb1f0db22b8959e3091", size = 7976033, upload-time = "2024-10-12T20:42:16.215Z" },
]
[[package]]
name = "pywin32-prj"
version = "0.1.0"
source = { virtual = "." }
dependencies = [
{ name = "pywin32", marker = "sys_platform == 'win32'" },
]
[package.metadata]
requires-dist = [{ name = "pywin32", marker = "sys_platform == 'win32'" }]
"#
);
});
Ok(())
}
#[test]
fn lock_empty_extra() -> Result<()> {
let context = TestContext::new("3.12");