Skip to content

Commit 1c1acdc

Browse files
committed
Clarify doc and format code
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent eecd896 commit 1c1acdc

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/packagedcode/build.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,26 +102,26 @@ class BaseStarlarkManifestHandler(models.DatafileHandler):
102102
def assemble(cls, package_data, resource, codebase, package_adder):
103103
"""
104104
Given a ``package_data`` PackageData found in the ``resource`` datafile
105-
of the ``codebase``, assemble package their files and dependencies
106-
from one or more datafiles.
105+
of the ``codebase``, assemble and yield a Package with its files and
106+
dependencies from one or more datafiles.
107107
"""
108-
datafile_path = resource.path
109108
# do we have enough to create a package?
110109
if package_data.purl:
111110
package = models.Package.from_package_data(
112111
package_data=package_data,
113-
datafile_path=datafile_path,
112+
datafile_path=resource.path,
114113
)
115114

116115
if TRACE:
117-
logger_debug(f"build: assemble: package_data: {package_data.to_dict()}")
116+
logger_debug(f"BaseStarlarkManifestHandler.assemble: package_data: {package_data.to_dict()}")
118117

119-
package.license_detections, package.declared_license_expression = \
120-
get_license_detections_and_expression(
121-
package=package_data,
122-
resource=resource,
123-
codebase=codebase,
124-
)
118+
detections, expression = get_license_detections_and_expression(
119+
package=package_data,
120+
resource=resource,
121+
codebase=codebase,
122+
)
123+
package.license_detections = detections
124+
package.declared_license_expression = expression
125125

126126
cls.assign_package_to_resources(
127127
package=package,

src/packagedcode/licensing.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,9 @@ def get_license_detection_mappings(
385385
package_license=True,
386386
):
387387
"""
388-
Return a list of LicenseDetection objects by running license detection
389-
on `location`. This performs similarly to `scancode.api.get_licenses`.
388+
Return a list of LicenseDetection mappings by running license detection on
389+
the file at ``location``. This performs license detection the same way as
390+
with `scancode.api.get_licenses`.
390391
"""
391392
license_detections = []
392393
detections = detect_licenses(
@@ -399,9 +400,11 @@ def get_license_detection_mappings(
399400

400401
for detection in detections:
401402
# TODO: also return these?
403+
# FIXME: How can we ever get a license detection WITHOUT an expression??
402404
if detection.license_expression is None:
403405
continue
404406

407+
# FIXME: why not honoring the arguments for include_text and license_text_diagnostics?
405408
license_detections.append(
406409
detection.to_dict(
407410
include_text=True,

0 commit comments

Comments
 (0)