Skip to content

Commit

Permalink
Bug fix in parsePyLock
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Jan 27, 2025
1 parent 07c0398 commit ac446c0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
70 changes: 36 additions & 34 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5124,40 +5124,42 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
addedValue[p.value] = true;
}
}
for (const pprop of parentPkg.properties) {
if (
pprop.name.startsWith("internal:workspace") &&
!addedValue[pprop.value]
) {
dependentPkg.properties.push(pprop);
addedValue[pprop.value] = true;
} else if (pprop.name === "internal:is_workspace") {
dependentPkg.properties.push({
name: "internal:workspaceRef",
value: parentPkg["bom-ref"],
});
dependentPkg.properties.push({
name: "internal:workspaceSrcFile",
value: workspaceRefPyProjMap[parentPkg["bom-ref"]],
});
addedValue[parentPkg["bom-ref"]] = true;
addedValue[workspaceRefPyProjMap[parentPkg["bom-ref"]]] = true;
const childDeps = depsMap[dependentPkg["bom-ref"]];
for (const childRef of childDeps) {
if (!childRef.startsWith("pkg:")) {
continue;
}
const childPkg = pkgBomRefMap[childRef];
if (childPkg) {
childPkg.properties = childPkg.properties || [];
childPkg.properties.push({
name: "internal:workspaceRef",
value: parentPkg["bom-ref"],
});
childPkg.properties.push({
name: "internal:workspaceSrcFile",
value: workspaceRefPyProjMap[parentPkg["bom-ref"]],
});
if (parentPkg?.properties?.length) {
for (const pprop of parentPkg.properties) {
if (
pprop.name.startsWith("internal:workspace") &&
!addedValue[pprop.value]
) {
dependentPkg.properties.push(pprop);
addedValue[pprop.value] = true;
} else if (pprop.name === "internal:is_workspace") {
dependentPkg.properties.push({
name: "internal:workspaceRef",
value: parentPkg["bom-ref"],
});
dependentPkg.properties.push({
name: "internal:workspaceSrcFile",
value: workspaceRefPyProjMap[parentPkg["bom-ref"]],
});
addedValue[parentPkg["bom-ref"]] = true;
addedValue[workspaceRefPyProjMap[parentPkg["bom-ref"]]] = true;
const childDeps = depsMap[dependentPkg["bom-ref"]];
for (const childRef of childDeps) {
if (!childRef.startsWith("pkg:")) {
continue;
}
const childPkg = pkgBomRefMap[childRef];
if (childPkg) {
childPkg.properties = childPkg.properties || [];
childPkg.properties.push({
name: "internal:workspaceRef",
value: parentPkg["bom-ref"],
});
childPkg.properties.push({
name: "internal:workspaceSrcFile",
value: workspaceRefPyProjMap[parentPkg["bom-ref"]],
});
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion types/lib/helpers/utils.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac446c0

Please sign in to comment.