mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
fix: exclude packages without artifacts from PEX lock file
- Add validation to only include packages with at least one artifact - Skip packages that have no downloadable wheels or source distributions - Prevents PEX parser error: "expected to have at least one artifact" This ensures all locked requirements have valid downloadable artifacts as required by the PEX specification. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f0a5b64b33
commit
a884d5e84f
1 changed files with 21 additions and 18 deletions
|
@ -199,26 +199,29 @@ impl PexLock {
|
|||
}
|
||||
|
||||
if let Some(version) = &package.id.version {
|
||||
// Collect dependencies for this package
|
||||
let mut requires_dists = Vec::new();
|
||||
for dep in &package.dependencies {
|
||||
if let Some(dep_version) = lock
|
||||
.packages()
|
||||
.iter()
|
||||
.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));
|
||||
// Only include packages that have at least one artifact
|
||||
if !artifacts.is_empty() {
|
||||
// Collect dependencies for this package
|
||||
let mut requires_dists = Vec::new();
|
||||
for dep in &package.dependencies {
|
||||
if let Some(dep_version) = lock
|
||||
.packages()
|
||||
.iter()
|
||||
.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locked_requirements.push(PexLockedRequirement {
|
||||
artifacts,
|
||||
project_name: package.id.name.to_string(),
|
||||
requires_dists,
|
||||
requires_python: lock.requires_python().to_string(),
|
||||
version: version.to_string(),
|
||||
});
|
||||
locked_requirements.push(PexLockedRequirement {
|
||||
artifacts,
|
||||
project_name: package.id.name.to_string(),
|
||||
requires_dists,
|
||||
requires_python: lock.requires_python().to_string(),
|
||||
version: version.to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue