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

Method parse

src/packagedcode/rpm.py:523–547  ·  view source on GitHub ↗
(cls, location, package_only=False)

Source from the content-addressed store, hash-verified

521
522 @classmethod
523 def parse(cls, location, package_only=False):
524
525 # The license files are in a directory which is the package name,
526 # for example: "/usr/share/licenses/openssl/LICENSE"
527 name = location.split('/usr/share/licenses/').pop().split('/')[0]
528 package_data = models.PackageData(
529 type=cls.default_package_type,
530 namespace=cls.default_package_namespace,
531 name=name,
532 datasource_id=cls.datasource_id,
533 )
534
535 if package_only:
536 yield package_data
537
538 resource_license_attributes = get_licenses(
539 location=location,
540 include_text=True,
541 license_diagnostics=True,
542 license_text_diagnostics=True,
543 )
544 for key, key_pkg in RESOURCE_TO_PACKAGE_LICENSE_FIELDS.items():
545 setattr(package_data, key_pkg, resource_license_attributes.get(key))
546
547 yield package_data
548
549
550ALGO_BY_ID = {

Callers

nothing calls this directly

Calls 4

get_licensesFunction · 0.90
getMethod · 0.65
splitMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected