How to use the rez.utils.colorize.Printer function in rez

To help you get started, we’ve selected a few rez examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nerdvegas / rez / src / rez / utils / logging_.py View on Github external
while True:
                line = f.readline()
                if not line:
                    break

                line = line.rstrip()  # strip newline
                color = last_color

                if loglevel_index:
                    parts = line.split()
                    if len(parts) > loglevel_index:
                        color = colors.get(parts[loglevel_index], last_color)
                        last_color = color

                if color:
                    colorize.Printer()(line, color)
                else:
                    print(line)
github nerdvegas / rez / src / rez / wrapper.py View on Github external
rows = []
                colors = []

                for pkg in sorted(it, key=lambda x: x.version, reverse=True):
                    if pkg.version == variant.version:
                        name = "* %s" % pkg.qualified_name
                        col = heading
                    else:
                        name = "  %s" % pkg.qualified_name
                        col = local if pkg.is_local else None

                    label = "(local)" if pkg.is_local else ""
                    rows.append((name, pkg.path, label))
                    colors.append(col)

                _pr = Printer()
                for col, line in zip(colors, columnise(rows)):
                    _pr(line, col)
        return 0
github nerdvegas / rez / src / rez / cli / pkg-cache.py View on Github external
for c in opts.columns:
                if c == "status":
                    row.append(status_str)
                elif c == "package":
                    row.append(variant.parent.qualified_name)
                elif c == "variant_uri":
                    row.append(variant.uri)
                elif c == "orig_path":
                    row.append(variant.root)
                else:  # cached_path
                    row.append(rootpath or '-')

            row.append(color)
            rows.append(row)

        pr = colorize.Printer()
        print_colored_columns(pr, rows)
github nerdvegas / rez / src / rezplugins / build_process / local.py View on Github external
install_path=release_path,
                       variants=released_variants,
                       release_message=release_message,
                       changelog=changelog,
                       previous_version=previous_version,
                       previous_revision=previous_revision)

        # perform post-release actions: tag repo etc
        if released_variants:
            self.post_release(release_message=release_message)

        self._print_header("Release Summary")

        msg = "\n%d of %d releases were successful" % (num_released, num_visited)
        if num_released < num_visited:
            Printer()(msg, warning)
        else:
            self._print(msg)

        if self.all_test_results.num_tests:
            print('')
            self.all_test_results.print_summary()
            print('')

        return num_released
github nerdvegas / rez / src / rezplugins / build_system / custom.py View on Github external
install_ = "install" if install else ''
            return txt.format(root=root, install=install_).strip()

        if isinstance(command, basestring):
            if self.build_args:
                command = command + ' ' + ' '.join(map(quote, self.build_args))

            command = expand(command)
            cmd_str = command
        else:  # list
            command = command + self.build_args
            command = list(map(expand, command))
            cmd_str = ' '.join(map(quote, command))

        if self.verbose:
            pr = Printer(sys.stdout)
            pr("Running build command: %s" % cmd_str, heading)

        # run the build command
        def _callback(executor):
            self._add_build_actions(executor,
                                    context=context,
                                    package=self.package,
                                    variant=variant,
                                    build_type=build_type,
                                    install=install,
                                    build_path=build_path,
                                    install_path=install_path)

            if self.opts:
                # write args defined in ./parse_build_args.py out as env vars
                extra_args = getattr(self.opts.parser, "_rezbuild_extra_args", [])
github nerdvegas / rez / src / rez / wrapper.py View on Github external
def _print_conflicting(cls, variants):
        vars_str = " ".join(x.qualified_package_name for x in variants)
        msg = "Packages (in conflict): %s" % vars_str
        Printer()(msg, critical)
github nerdvegas / rez / src / rez / build_process_.py View on Github external
def _print_header(self, txt, n=1):
        if self.quiet:
            return

        self._print('')
        if n <= 1:
            br = '=' * 80
            title = "%s\n%s\n%s" % (br, txt, br)
        else:
            title = "%s\n%s" % (txt, '-' * len(txt))

        pr = Printer(sys.stdout)
        pr(title, heading)