MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_alpine_license_detection

Function get_alpine_license_detection

src/packagedcode/alpine.py:1387–1417  ·  view source on GitHub ↗

Return an ApkLicenseDetection from a ``declared`` license text

(declared)

Source from the content-addressed store, hash-verified

1385
1386
1387def get_alpine_license_detection(declared):
1388 """
1389 Return an ApkLicenseDetection from a ``declared`` license text
1390 """
1391 # cleaning first to fix syntax quirks and try to get something we can parse
1392 cleaned_license = normalize_and_cleanup_declared_license(declared)
1393 if not cleaned_license:
1394 return None
1395
1396 # then we apply mappings for known non-standard symbols.
1397 # the output should be a proper SPDX expression
1398 mapped_license = apply_expressions_mapping(cleaned_license)
1399
1400 # Finally perform SPDX expressions detection: Alpine uses mostly SPDX, but
1401 # with some quirks such as some non standard symbols (in addition to the
1402 # non-standard syntax)
1403 extra_licenses = {}
1404 expression_symbols = get_license_symbols(extra_licenses=extra_licenses)
1405
1406 license_detections, license_expression = get_license_detections_and_expression(
1407 extracted_license_statement=mapped_license,
1408 expression_symbols=expression_symbols,
1409 )
1410
1411 return ApkLicenseDetection(
1412 declared_license=declared,
1413 cleaned_license=cleaned_license,
1414 mapped_license=mapped_license,
1415 license_expression=license_expression,
1416 license_detections=license_detections,
1417 )
1418
1419
1420def detect_declared_license(declared):

Callers 1

detect_declared_licenseFunction · 0.85

Tested by

no test coverage detected