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

Function parse_apkbuild

src/packagedcode/alpine.py:253–269  ·  view source on GitHub ↗

Return a PackageData object from an APKBUILD file at ``location`` or None. If ``strict`` is True, raise ApkbuildParseFailure error if any attribute value cannot be fully resolved for shell variables.

(location, strict=False, package_only=False)

Source from the content-addressed store, hash-verified

251
252
253def parse_apkbuild(location, strict=False, package_only=False):
254 """
255 Return a PackageData object from an APKBUILD file at ``location`` or None.
256
257 If ``strict`` is True, raise ApkbuildParseFailure error if any attribute
258 value cannot be fully resolved for shell variables.
259 """
260 with open(location, 'rb') as f:
261 apkbuild = as_unicode(f.read())
262
263 return parse_apkbuild_text(
264 text=apkbuild,
265 datasource_id=AlpineApkbuildHandler.datasource_id,
266 package_type=AlpineApkbuildHandler.default_package_type,
267 strict=strict,
268 package_only=package_only,
269 )
270
271
272class ApkbuildParseFailure(Exception):

Callers 2

parseMethod · 0.85

Calls 3

as_unicodeFunction · 0.90
parse_apkbuild_textFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected