mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
fix: add missing requires_dists field to PEX locked requirements
- Add requires_dists field to PexLockedRequirement structure - Populate requires_dists with package dependencies during export - Ensure PEX format compliance with expected field structure Fixes PEX parser error: "did not have the expected key 'requires_dists'" 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c8fff41da5
commit
8ba02a3367
1 changed files with 16 additions and 0 deletions
|
@ -68,6 +68,8 @@ pub struct PexLockedRequirement {
|
|||
pub requirement: String,
|
||||
/// Artifacts (wheels/sdists) for this requirement.
|
||||
pub artifacts: Vec<PexArtifact>,
|
||||
/// Dependencies of this requirement.
|
||||
pub requires_dists: Vec<String>,
|
||||
}
|
||||
|
||||
/// An artifact in a PEX lock file.
|
||||
|
@ -181,11 +183,25 @@ 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));
|
||||
}
|
||||
}
|
||||
|
||||
locked_requirements.push(PexLockedRequirement {
|
||||
project_name: package.id.name.to_string(),
|
||||
version: version.to_string(),
|
||||
requirement: format!("{}=={}", package.id.name, version),
|
||||
artifacts,
|
||||
requires_dists,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue