Example #1
0
def build_command(prefix, pkg, define, test, configure, clean, path, yes,
                  target, generator):
    """ Build package """
    pb = PackageBuild(pkg).merge_defines(define)
    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)
Example #2
0
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))
Example #3
0
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))
Example #4
0
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)
Example #5
0
def install_command(prefix, pkgs, define, file, test, test_all, update,
                    generator, cmake):
    """ Install packages """
    pbs = [PackageBuild(pkg, define=define, cmake=cmake) for pkg in pkgs]
    for pb in list(prefix.from_file(file)) + pbs:
        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))
Example #6
0
def install_command(prefix, pkgs, define, file, test, test_all, update,
                    generator):
    """ Install packages """
    pbs = [PackageBuild(pkg) for pkg in pkgs]
    for pb in list(prefix.from_file(file)) + pbs:
        try:
            click.echo(
                prefix.install(pb.merge(define),
                               test=test,
                               test_all=test_all,
                               update=update,
                               generator=generator))
        except:
            click.echo("Failed to build package {}".format(pb.to_name()))
            prefix.remove(pb)
            if prefix.verbose: raise
Example #7
0
File: cli.py Project: i-v-s/cget
def install1_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'
    pbs = [
        PackageBuild(pkg, define=define, cmake=cmake, variant=variant)
        for pkg in pkgs
    ]
    for pb in util.flat([prefix.from_file(file), pbs]):
        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))