Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_pkg_build(self, pkg, start=None, no_recipe=False):
if isinstance(pkg, PackageBuild):
pkg.pkg_src = self.parse_pkg_src(pkg.pkg_src, start, no_recipe)
if pkg.pkg_src.recipe: pkg = self.from_recipe(pkg.pkg_src.recipe, pkg)
if pkg.cmake: pkg.cmake = find_cmake(pkg.cmake, start)
return pkg
else:
pkg_src = self.parse_pkg_src(pkg, start, no_recipe)
if pkg_src.recipe: return self.from_recipe(pkg_src.recipe, pkg_src.name)
else: return PackageBuild(pkg_src)
def parse_pkg_build_tokens(args):
parser = argparse.ArgumentParser()
parser.add_argument('pkg_src', nargs='?')
parser.add_argument('-D', '--define', action='append', default=[])
parser.add_argument('-H', '--hash')
parser.add_argument('-X', '--cmake')
parser.add_argument('-f', '--file')
parser.add_argument('-t', '--test', action='store_true')
parser.add_argument('-b', '--build', action='store_true')
return parser.parse_args(args=args, namespace=PackageBuild())
def parse_pkg_src(self, pkg, start=None, no_recipe=False):
if isinstance(pkg, PackageSource): return pkg
if isinstance(pkg, PackageBuild): return self.parse_pkg_src(pkg.pkg_src, start)
name, url = parse_alias(pkg)
self.log('parse_pkg_src:', name, url, pkg)
if '://' not in url:
return self.parse_src_file(name, url, start) or \
(None if no_recipe else self.parse_src_recipe(name, url)) or \
self.parse_src_github(name, url)
return PackageSource(name=name, url=url)
def parse_pkg_build(self, pkg, start=None, no_recipe=False):
if isinstance(pkg, PackageBuild):
pkg.pkg_src = self.parse_pkg_src(pkg.pkg_src, start, no_recipe)
if pkg.pkg_src.recipe: pkg = self.from_recipe(pkg.pkg_src.recipe, pkg)
if pkg.cmake: pkg.cmake = find_cmake(pkg.cmake, start)
return pkg
else:
pkg_src = self.parse_pkg_src(pkg, start, no_recipe)
if pkg_src.recipe: return self.from_recipe(pkg_src.recipe, pkg_src.name)
else: return PackageBuild(pkg_src)