Skip to content

Commit

Permalink
Fix bug at following package license references
Browse files Browse the repository at this point in the history
Reference: #3969
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
  • Loading branch information
AyanSinhaMahapatra committed Nov 5, 2024
1 parent d23d120 commit dedccc5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/licensedcode/plugin_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ def add_referenced_filenames_license_matches_for_detections(resource, codebase):
path=referenced_resource.path
)

if not referenced_detections:
continue

referenced_license_expression = combine_expressions(
expressions=[
detection["license_expression"]
Expand All @@ -314,15 +317,15 @@ def add_referenced_filenames_license_matches_for_detections(resource, codebase):
referenced_license_expression=referenced_license_expression,
license_detection=license_detection,
):
if TRACE_REFERENCE:
if TRACE_REFERENCE and referenced_resource:
logger_debug(
f'use_referenced_license_expression: False for '
f'resource: {referenced_resource.path} and '
f'license_expression: {referenced_license_expression}',
)
continue

if TRACE_REFERENCE:
if TRACE_REFERENCE and referenced_resource:
logger_debug(
f'use_referenced_license_expression: True for '
f'resource: {referenced_resource.path} and '
Expand Down
3 changes: 3 additions & 0 deletions src/packagedcode/licensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ def add_referenced_license_matches_for_package(resource, codebase):
):
continue

if not (referenced_resource and referenced_resource.license_detections):
continue

modified = True
detections_added.extend(referenced_resource.license_detections)
matches_to_extend = get_matches_from_detection_mappings(
Expand Down

0 comments on commit dedccc5

Please sign in to comment.