mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
fix: filter Windows-specific wheels from PEX lock for Linux/Mac targets
- Add platform filtering to exclude Windows wheels (Win32, WinAmd64, WinArm64, WinIa64) - Import uv_platform_tags::PlatformTag for platform detection - Only include platform-compatible artifacts in PEX lock file - Fixes "Failed to resolve compatible artifacts" error for Linux targets This prevents Windows-only packages like pywin32 from being included in PEX lock files targeting Linux/Mac systems. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d8cdb7c199
commit
67e3aaa6db
1 changed files with 19 additions and 2 deletions
|
@ -12,6 +12,7 @@
|
|||
use std::fmt;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uv_platform_tags::PlatformTag;
|
||||
|
||||
use crate::lock::{Lock, LockError, WheelWireSource};
|
||||
|
||||
|
@ -153,8 +154,23 @@ impl PexLock {
|
|||
// Create locked requirement
|
||||
let mut artifacts = Vec::new();
|
||||
|
||||
// Add wheels
|
||||
// Add wheels (excluding Windows-specific wheels for Linux/Mac targets)
|
||||
for wheel in &package.wheels {
|
||||
// Filter out Windows-specific wheels when targeting linux/mac
|
||||
let is_windows_wheel = wheel.filename.platform_tags().iter().any(|tag| {
|
||||
matches!(
|
||||
tag,
|
||||
PlatformTag::Win32
|
||||
| PlatformTag::WinAmd64
|
||||
| PlatformTag::WinArm64
|
||||
| PlatformTag::WinIa64
|
||||
)
|
||||
});
|
||||
|
||||
if is_windows_wheel {
|
||||
continue;
|
||||
}
|
||||
|
||||
let wheel_url = match &wheel.url {
|
||||
WheelWireSource::Url { url } => url.to_string(),
|
||||
WheelWireSource::Path { path } => format!("file://{}", path.to_string_lossy()),
|
||||
|
@ -212,7 +228,8 @@ impl PexLock {
|
|||
.find(|pkg| pkg.id.name == dep.package_id.name)
|
||||
.and_then(|pkg| pkg.id.version.as_ref())
|
||||
{
|
||||
requires_dists.push(format!("{}=={}", dep.package_id.name, dep_version));
|
||||
requires_dists
|
||||
.push(format!("{}=={}", dep.package_id.name, dep_version));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue