Skip to content

Commit a86fa74

Browse files
Fix package creation crash for purl less deps
Fixes #2911 Do not create top level dependencies in case of dependencies without purls, these are encountered in pypi requirements with local paths. Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
1 parent 4634e0a commit a86fa74

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/packagedcode/models.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,17 @@ def from_dependent_packages(
436436
"""
437437
dependent_packages = dependent_packages or []
438438
for dependent_package in dependent_packages:
439-
yield Dependency.from_dependent_package(
440-
dependent_package=dependent_package,
441-
datafile_path=datafile_path,
442-
datasource_id=datasource_id,
443-
package_uid=package_uid,
444-
)
439+
if dependent_package.purl:
440+
yield Dependency.from_dependent_package(
441+
dependent_package=dependent_package,
442+
datafile_path=datafile_path,
443+
datasource_id=datasource_id,
444+
package_uid=package_uid,
445+
)
446+
else:
447+
if TRACE:
448+
logger_debug(f' Dependency.from_dependent_packages: dependent_package (does not have purl): {dependent_package}')
449+
pass
445450

446451

447452
@attr.attributes(slots=True)

0 commit comments

Comments
 (0)