Ejemplo n.º 1
0
def _save_graph(graph_str, filepath, prune_to):
    # rez cli tools do a killpg() on sig handling, this inadvertantly causes
    # the main GUI to terminate when Writer.process is terminated! Setting this
    # variable suppresses the killpg() and stops that from happening.
    os.environ["_REZ_NO_KILLPG"] = "1"
    os.environ["_REZ_QUIET_ON_SIG"] = "1"
    if prune_to:
        graph_str = prune_graph(graph_str, prune_to)
    save_graph(graph_str, filepath)
Ejemplo n.º 2
0
def _save_graph(graph_str, filepath, prune_to):
    # rez cli tools do a killpg() on sig handling, this inadvertantly causes
    # the main GUI to terminate when Writer.process is terminated! Setting this
    # variable suppresses the killpg() and stops that from happening.
    os.environ["_REZ_NO_KILLPG"] = "1"
    os.environ["_REZ_QUIET_ON_SIG"] = "1"
    if prune_to:
        graph_str = prune_graph(graph_str, prune_to)
    save_graph(graph_str, filepath)
Ejemplo n.º 3
0
    def write_graph(self):
        if self.prune_to:
            graph_str = prune_graph(self.graph_str, self.prune_to)
        else:
            graph_str = self.graph_str

        error_msg = ''
        try:
            save_graph(graph_str, self.filepath)
        except Exception as e:
            error_msg = str(e)

        self.graph_written.emit(self.filepath, error_msg)
Ejemplo n.º 4
0
    def write_graph(self):
        if self.prune_to:
            graph_str = prune_graph(self.graph_str, self.prune_to)
        else:
            graph_str = self.graph_str

        error_msg = ''
        try:
            save_graph(graph_str, self.filepath)
        except Exception as e:
            error_msg = str(e)

        self.graph_written.emit(self.filepath, error_msg)
Ejemplo n.º 5
0
def command(opts, parser, extra_arg_groups=None):
    from rez.package_search import get_reverse_dependency_tree
    from rez.utils.graph_utils import save_graph, view_graph
    from rez.config import config
    from rez.vendor.pygraph.readwrite.dot import write as write_dot
    import os
    import os.path

    config.override("warn_none", True)
    config.override("show_progress", (not opts.quiet))

    if opts.paths is None:
        pkg_paths = None
    else:
        pkg_paths = opts.paths.split(os.pathsep)
        pkg_paths = [os.path.expanduser(x) for x in pkg_paths if x]

    pkgs_list, g = get_reverse_dependency_tree(
        package_name=opts.PKG,
        depth=opts.depth,
        paths=pkg_paths,
        build_requires=opts.build_requires,
        private_build_requires=opts.private_build_requires)

    if opts.graph or opts.print_graph or opts.write_graph:
        gstr = write_dot(g)
        if opts.print_graph:
            print(gstr)
        elif opts.write_graph:
            save_graph(gstr, dest_file=opts.write_graph)
        else:
            view_graph(gstr)
        return 0

    for i, pkgs in enumerate(pkgs_list):
        if opts.quiet:
            toks = pkgs
        else:
            toks = ["#%d:" % i] + pkgs
        print(' '.join(toks))
Ejemplo n.º 6
0
def command(opts, parser, extra_arg_groups=None):
    from rez.package_search import get_reverse_dependency_tree
    from rez.utils.graph_utils import save_graph, view_graph
    from rez.config import config
    from rez.vendor.pygraph.readwrite.dot import write as write_dot
    import os
    import os.path

    config.override("warn_none", True)
    config.override("show_progress", (not opts.quiet))

    if opts.paths is None:
        pkg_paths = None
    else:
        pkg_paths = opts.paths.split(os.pathsep)
        pkg_paths = [os.path.expanduser(x) for x in pkg_paths if x]

    pkgs_list, g = get_reverse_dependency_tree(
        package_name=opts.PKG,
        depth=opts.depth,
        paths=pkg_paths,
        build_requires=opts.build_requires,
        private_build_requires=opts.private_build_requires)

    if opts.graph or opts.print_graph or opts.write_graph:
        gstr = write_dot(g)
        if opts.print_graph:
            print gstr
        elif opts.write_graph:
            save_graph(gstr, dest_file=opts.write_graph)
        else:
            view_graph(gstr)
        return 0

    for i, pkgs in enumerate(pkgs_list):
        if opts.quiet:
            toks = pkgs
        else:
            toks = ["#%d:" % i] + pkgs
        print ' '.join(toks)