MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / get_package_base_dir

Function get_package_base_dir

aboutcode/hashid/__init__.py:142–151  ·  view source on GitHub ↗

Return the base path to a Package directory (ignoring version) for a purl

(purl: Union[PackageURL, str])

Source from the content-addressed store, hash-verified

140
141
142def get_package_base_dir(purl: Union[PackageURL, str]):
143 """
144 Return the base path to a Package directory (ignoring version) for a purl
145 """
146 if isinstance(purl, str):
147 purl = PackageURL.from_string(purl)
148
149 path_elements = package_path_elements(purl)
150 phash, core_path, _pversion, _extra_path = path_elements
151 return Path(f"{PACKAGE_REPOS_NAME_PREFIX}-{purl.type}-{phash}") / core_path
152
153
154def get_package_purls_yml_file_path(purl: Union[PackageURL, str]):

Calls 1

package_path_elementsFunction · 0.85

Tested by

no test coverage detected