Пример #1
0
 def _render_digraph(self, nx_graph):
     if self.renderer == 'd3':
         graph.draw_networkx_with_d3(nx_graph, self.third_party, self.out)
     elif self.renderer == 'pydot':
         fetch_build_eggs(['pydot'], dist=self.distribution)
         graph.draw_networkx_with_pydot(nx_graph, self.third_party,
                                        self.out)
Пример #2
0
    def run(self):
        if not self.distribution.get_name() == 'UNKNOWN':
            self.run_command('egg_info')
        self.banner("Dependency Graph: note - includes only installed "
                    "packages")

        all_packages = dependency.all_packages(
                           exclusions=self.exclude,
                           include_third_party=self.third_party,
                           exclude_pinned=False)
        if not all_packages:
            log.info("No matching packages to render")
            return


        if self.distribution.get_name() == 'UNKNOWN' and not self.args:
            # Pick any package and set the 'everything' flag if nothing was 
            # specified
            pkg = all_packages.keys()[0]
            self.everything = True
            self.args = [pkg]
            if 'UNKNOWN' in all_packages:
                del all_packages['UNKNOWN']

        roots = []
        if self.args:
            roots = [safe_name(i) for i in self.args]
            for i in roots:
                if not i in all_packages.keys():
                    raise DistutilsOptionError("Unknown package: %s" % i)

        if not roots:
            roots = [self.distribution.get_name()]

        self.banner("Rendering using %s" % self.renderer)

        if self.renderer in ['ascii', 'graphviz']:
            # TODO: use nx digraph as below, retire get_targets
            src, eggs = dependency.get_targets(roots, all_packages,
                                               everything=self.everything,
                                               immediate_deps=True,
                                               follow_all=True,
                                               include_eggs=True,
                                               include_source=True,)

            graph.draw_graph(inclusions=src + eggs, renderer=self.renderer,
                             outfile=self.out)

        else:
            nx_graph, _ = dependency.get_graph_from_ws(working_set)

            if self.renderer == 'd3':
                graph.draw_networkx_with_d3(nx_graph, self.third_party,
                                            self.out)
            elif self.renderer == 'pydot':
                self.fetch_build_eggs(['pydot'])
                graph.draw_networkx_with_pydot(nx_graph, self.third_party,
                                               self.out, self.requirements)
Пример #3
0
 def _render_digraph(self, nx_graph):
     if self.renderer == 'd3':
         graph.draw_networkx_with_d3(nx_graph, self.third_party, self.out)
     elif self.renderer == 'pydot':
         fetch_build_eggs(['pydot'], dist=self.distribution)
         graph.draw_networkx_with_pydot(nx_graph, self.third_party, self.out)