From 9b67683a6164fabcb609d07ee26f4613c8659bce Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 20 Feb 2025 14:17:40 -0800 Subject: [PATCH] Include uppercase platforms for Windows wheels --- crates/uv-resolver/src/lock/mod.rs | 5 +- crates/uv/tests/it/lock.rs | 77 ++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/crates/uv-resolver/src/lock/mod.rs b/crates/uv-resolver/src/lock/mod.rs index d5903e487d7c..be9acd766c7b 100644 --- a/crates/uv-resolver/src/lock/mod.rs +++ b/crates/uv-resolver/src/lock/mod.rs @@ -84,13 +84,13 @@ static MAC_MARKERS: LazyLock = LazyLock::new(|| { }); static ARM_MARKERS: LazyLock = LazyLock::new(|| { let pep508 = - MarkerTree::from_str("platform_machine == 'aarch64' or platform_machine == 'arm64'") + MarkerTree::from_str("platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ARM64'") .unwrap(); UniversalMarker::new(pep508, ConflictMarker::TRUE) }); static X86_64_MARKERS: LazyLock = LazyLock::new(|| { let pep508 = - MarkerTree::from_str("platform_machine == 'x86_64' or platform_machine == 'amd64'") + MarkerTree::from_str("platform_machine == 'x86_64' or platform_machine == 'amd64' or platform_machine == 'AMD64'") .unwrap(); UniversalMarker::new(pep508, ConflictMarker::TRUE) }); @@ -326,7 +326,6 @@ impl Lock { } if platform_tags.iter().all(PlatformTag::is_windows) { - // TODO(charlie): This omits `win_ia64`, which is accepted by Warehouse. if graph.graph[node_index] .marker() .is_disjoint(*WINDOWS_MARKERS) diff --git a/crates/uv/tests/it/lock.rs b/crates/uv/tests/it/lock.rs index 7deb3f876929..9fcc60b243f2 100644 --- a/crates/uv/tests/it/lock.rs +++ b/crates/uv/tests/it/lock.rs @@ -25553,3 +25553,80 @@ fn lock_pytorch_local_preference() -> Result<()> { Ok(()) } + +#[test] +fn windows_arm() -> 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] + environments = [ + "sys_platform == 'linux' and platform_machine == 'x86_64'", + "sys_platform == 'win32' and platform_machine == 'AMD64'", + ] + "#, + )?; + + 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 = 1 + requires-python = ">=3.12.[X], <3.13" + resolution-markers = [ + "platform_machine == 'x86_64' and sys_platform == 'linux'", + "platform_machine == 'AMD64' and sys_platform == 'win32'", + ] + supported-markers = [ + "platform_machine == 'x86_64' and sys_platform == 'linux'", + "platform_machine == 'AMD64' 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/21/27/0c8811fbc3ca188f93b5354e7c286eb91f80a53afa4e11007ef661afa746/pywin32-308-cp312-cp312-win_amd64.whl", hash = "sha256:00b3e11ef09ede56c6a43c71f2d31857cf7c54b0ab6e78ac659497abd2834f47", size = 6543015 }, + ] + + [[package]] + name = "pywin32-prj" + version = "0.1.0" + source = { virtual = "." } + dependencies = [ + { name = "pywin32", marker = "platform_machine == 'AMD64' and sys_platform == 'win32'" }, + ] + + [package.metadata] + requires-dist = [{ name = "pywin32", marker = "sys_platform == 'win32'" }] + "### + ); + }); + + Ok(()) +}