mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
fix: filter Windows-only dependencies from requires_dists
- Filter dependencies that only have Windows-specific artifacts - Check each dependency for compatible (non-Windows) wheels or sdist - Exclude Windows-only packages like pywin32 from dependency lists - Fixes "Dependency on pywin32 not satisfied, no candidates found" error This prevents Windows-only dependencies from being included in the requires_dists field when targeting Linux/Mac platforms, ensuring PEX can resolve all declared dependencies. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
67e3aaa6db
commit
a1ccbb7605
1 changed files with 22 additions and 5 deletions
|
@ -219,17 +219,34 @@ impl PexLock {
|
||||||
if let Some(version) = &package.id.version {
|
if let Some(version) = &package.id.version {
|
||||||
// Only include packages that have at least one artifact
|
// Only include packages that have at least one artifact
|
||||||
if !artifacts.is_empty() {
|
if !artifacts.is_empty() {
|
||||||
// Collect dependencies for this package
|
// Collect dependencies for this package (only those with compatible artifacts)
|
||||||
let mut requires_dists = Vec::new();
|
let mut requires_dists = Vec::new();
|
||||||
for dep in &package.dependencies {
|
for dep in &package.dependencies {
|
||||||
if let Some(dep_version) = lock
|
if let Some(dep_package) = lock
|
||||||
.packages()
|
.packages()
|
||||||
.iter()
|
.iter()
|
||||||
.find(|pkg| pkg.id.name == dep.package_id.name)
|
.find(|pkg| pkg.id.name == dep.package_id.name)
|
||||||
.and_then(|pkg| pkg.id.version.as_ref())
|
|
||||||
{
|
{
|
||||||
requires_dists
|
// Check if the dependency has any non-Windows artifacts
|
||||||
.push(format!("{}=={}", dep.package_id.name, dep_version));
|
let has_compatible_artifacts = dep_package.wheels.iter().any(|wheel| {
|
||||||
|
!wheel.filename.platform_tags().iter().any(|tag| {
|
||||||
|
matches!(
|
||||||
|
tag,
|
||||||
|
PlatformTag::Win32
|
||||||
|
| PlatformTag::WinAmd64
|
||||||
|
| PlatformTag::WinArm64
|
||||||
|
| PlatformTag::WinIa64
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}) || dep_package.sdist.is_some();
|
||||||
|
|
||||||
|
// Only include dependencies that have compatible artifacts
|
||||||
|
if has_compatible_artifacts {
|
||||||
|
if let Some(dep_version) = dep_package.id.version.as_ref() {
|
||||||
|
requires_dists
|
||||||
|
.push(format!("{}=={}", dep.package_id.name, dep_version));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue