Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def install_command(prefix, pkgs, define, file, test, test_all, update, generator, cmake, debug, release, insecure):
""" Install packages """
if debug and release:
click.echo("ERROR: debug and release are not supported together")
sys.exit(1)
variant = 'Release'
if debug: variant = 'Debug'
if not file and not pkgs:
if os.path.exists('dev-requirements.txt'): file = 'dev-requirements.txt'
else: file = 'requirements.txt'
pbs = [PackageBuild(pkg, cmake=cmake, variant=variant) for pkg in pkgs]
for pbu in util.flat([prefix.from_file(file), pbs]):
pb = pbu.merge_defines(define)
with prefix.try_("Failed to build package {}".format(pb.to_name()), on_fail=lambda: prefix.remove(pb)):
click.echo(prefix.install(pb, test=test, test_all=test_all, update=update, generator=generator, insecure=insecure))
def build_command(prefix, pkg, define, test, configure, clean, path, yes, target, generator, debug, release):
""" Build package """
pb = PackageBuild(pkg).merge_defines(define)
if debug and release:
click.echo("ERROR: debug and release are not supported together")
sys.exit(1)
pb.variant = 'Release'
if debug: pb.variant = 'Debug'
with prefix.try_("Failed to build package {}".format(pb.to_name())):
if configure: prefix.build_configure(pb)
elif path: click.echo(prefix.build_path(pb))
elif clean:
if not yes: yes = click.confirm("Are you sure you want to delete the build directory?")
if yes: prefix.build_clean(pb)
else: prefix.build(pb, test=test, target=target, generator=generator)
def ignore_command(prefix, pkgs):
""" Ignore packages """
pbs = [PackageBuild(pkg) for pkg in pkgs]
for pb in pbs:
with prefix.try_("Failed to ignore package {}".format(pb.to_name()), on_fail=lambda: prefix.remove(pb)):
click.echo(prefix.ignore(pb))