Beispiel #1
0
def command(opts, parser, extra_arg_groups=None):
    from rez.config import config

    # debug_package_release is used by rez.pip._verbose
    config.debug_package_release = config.debug_package_release or opts.verbose
    if not config.debug_package_release:
        # Prevent other rez.* loggers from printing debugs
        logging.getLogger('rez').setLevel(logging.INFO)

    from rez.pip import pip_install_package, run_pip_command
    import warnings

    if not (opts.search or opts.install):
        parser.error("Expected one of: --install, --search")

    if opts.search:
        with run_pip_command(["search", opts.PACKAGE]) as p:
            p.wait()
        return

    if opts.pip_ver:
        with warnings.catch_warnings():
            # Cause all warnings to always be triggered.
            warnings.simplefilter("always")
            warnings.warn(
                "The option --pip-version is deprecated and will be removed in a future version",
                category=DeprecationWarning)

    pip_install_package(opts.PACKAGE,
                        pip_version=opts.pip_ver,
                        python_version=opts.py_ver,
                        release=opts.release,
                        prefix=opts.prefix,
                        extra_args=opts.extra)
Beispiel #2
0
def command(opts, parser, extra_arg_groups=None):
    from rez.config import config
    config.debug_package_release = opts.verbose  # Used by rez.pip._verbose

    from rez.pip import pip_install_package, run_pip_command
    import warnings

    if not (opts.search or opts.install):
        parser.error("Expected one of: --install, --search")

    if opts.search:
        with run_pip_command(["search", opts.PACKAGE]) as p:
            p.wait()
        return

    if opts.pip_ver:
        with warnings.catch_warnings():
            # Cause all warnings to always be triggered.
            warnings.simplefilter("always")
            warnings.warn(
                "The option --pip-version is deprecated and will be removed in a future version",
                category=DeprecationWarning)

    installed_variants, skipped_variants = pip_install_package(
        opts.PACKAGE,
        pip_version=opts.pip_ver,
        python_version=opts.py_ver,
        release=opts.release,
        prefix=opts.prefix,
        extra_args=opts.extra)

    # print summary
    #

    def print_variant(v):
        pkg = v.parent
        txt = "%s: %s" % (pkg.qualified_name, pkg.uri)
        if v.subpath:
            txt += " (%s)" % v.subpath
        print("  " + txt)

    print()
    if installed_variants:
        print("%d packages were installed:" % len(installed_variants))
        for variant in installed_variants:
            print_variant(variant)
    else:
        print("NO packages were installed.")

    if skipped_variants:
        print()
        print("%d packages were already installed:" % len(skipped_variants))
        for variant in skipped_variants:
            print_variant(variant)

    print()
Beispiel #3
0
def command(opts, parser, extra_arg_groups=None):
    from rez.pip import pip_install_package, run_pip_command

    if not (opts.search or opts.install):
        parser.error("Expected one of: --install, --search")

    if opts.search:
        p = run_pip_command(["search", opts.PACKAGE])
        p.wait()
        return

    installed_variants, skipped_variants = set(), set()
    for package in opts.PACKAGE:
        installed, skipped = pip_install_package(
            package,
            python_version=opts.py_ver,
            release=opts.release,
            prefix=opts.prefix,
            no_deps=opts.no_deps,
            variants=opts.variant
        )

        installed_variants.update(installed)
        skipped_variants.update(skipped)

    # print summary
    #
    def print_variant(v):
        pkg = v.parent
        txt = "%s: %s" % (pkg.qualified_name, pkg.uri)
        if v.subpath:
            txt += " (%s)" % v.subpath
        print("  " + txt)

    print("")

    if installed_variants:
        print("%d packages were installed:" % len(installed_variants))
        for variant in installed_variants:
            print_variant(variant)
    else:
        print("NO packages were installed.")

    if skipped_variants:
        print("\n%d packages were already installed:" % len(skipped_variants))
        for variant in skipped_variants:
            print_variant(variant)

    print("")
Beispiel #4
0
def command(opts, parser, extra_arg_groups=None):
    from rez.pip import pip_install_package, run_pip_command
    import sys

    if not (opts.search or opts.install):
        parser.error("Expected one of: --install, --search")

    if opts.search:
        p = run_pip_command(["search", opts.PACKAGE])
        p.wait()
        return

    installed_variants, skipped_variants = pip_install_package(
        opts.PACKAGE,
        pip_version=opts.pip_ver,
        python_version=opts.py_ver,
        release=opts.release)

    # print summary
    #

    def print_variant(v):
        pkg = v.parent
        txt = "%s: %s" % (pkg.qualified_name, pkg.uri)
        if v.subpath:
            txt += " (%s)" % v.subpath
        print "  " + txt

    print
    if installed_variants:
        print "%d packages were installed:" % len(installed_variants)
        for variant in installed_variants:
            print_variant(variant)
    else:
        print "NO packages were installed."

    if skipped_variants:
        print
        print "%d packages were already installed:" % len(skipped_variants)
        for variant in skipped_variants:
            print_variant(variant)

    print