示例#1
0
    def info(self,
             reference,
             current_path,
             remote=None,
             options=None,
             settings=None,
             info=None,
             filename=None,
             update=False,
             check_updates=False,
             scopes=None,
             build_order=None,
             build_mode=None,
             package_settings=None):
        """ Fetch and build all dependencies for the given reference
        @param reference: ConanFileReference or path to user space conanfile
        @param current_path: where the output files will be saved
        @param remote: install only from that remote
        @param options: list of tuples: [(optionname, optionvalue), (optionname, optionvalue)...]
        @param settings: list of tuples: [(settingname, settingvalue), (settingname, value)...]
        @param package_settings: dict name=> settings: {"zlib": [(settingname, settingvalue), ...]}
        """
        def read_dates(deps_graph):
            ret = {}
            for ref, _ in sorted(deps_graph.nodes):
                if ref:
                    manifest = self._client_cache.load_manifest(ref)
                    ret[ref] = manifest.time_str
            return ret

        objects = self._get_graph(reference, current_path, remote, options,
                                  settings, filename, update, check_updates,
                                  None, scopes, package_settings, None, None)
        (builder, deps_graph, project_reference, registry, _, remote_proxy,
         _) = objects

        if build_order:
            result = deps_graph.build_order(build_order)
            self._user_io.out.info(", ".join(str(s) for s in result))
            return

        if build_mode is not False:  # sim_install is a policy or list of names (same as install build param)
            installer = ConanInstaller(self._client_cache, self._user_io,
                                       remote_proxy)
            nodes = installer.nodes_to_build(deps_graph, build_mode)
            counter = Counter(ref.conan.name for ref, _ in nodes)
            self._user_io.out.info(", ".join(
                (str(ref) if counter[ref.conan.name] > 1 else str(ref.conan))
                for ref, _ in nodes))
            return

        if check_updates:
            graph_updates_info = builder.get_graph_updates_info(deps_graph)
        else:
            graph_updates_info = {}

        Printer(self._user_io.out).print_info(deps_graph, project_reference,
                                              info, registry,
                                              graph_updates_info, remote,
                                              read_dates(deps_graph))
示例#2
0
 def info_nodes_to_build(self, reference, profile, build_modes, remote,
                         check_updates):
     remote_proxy = ConanProxy(self._client_cache,
                               self._user_io,
                               self._remote_manager,
                               remote,
                               update=False,
                               check_updates=check_updates,
                               recorder=self._recorder)
     deps_graph, _, conanfile = self._get_deps_graph(
         reference, profile, remote_proxy)
     build_mode = BuildMode(build_modes, self._user_io.out)
     installer = ConanInstaller(self._client_cache,
                                self._user_io.out,
                                remote_proxy,
                                build_mode,
                                None,
                                recorder=self._recorder)
     nodes = installer.nodes_to_build(deps_graph)
     counter = Counter(ref.conan.name for ref, _ in nodes)
     ret = [
         ref if counter[ref.conan.name] > 1 else str(ref.conan)
         for ref, _ in nodes
     ]
     return ret, self._get_project_reference(reference, conanfile)
示例#3
0
文件: manager.py 项目: nesono/conan
 def info_nodes_to_build(self, reference, profile, filename, build_modes, remote, check_updates, cwd):
     remote_proxy = ConanProxy(self._client_cache, self._user_io, self._remote_manager, remote,
                               update=False, check_updates=check_updates)
     deps_graph, _, conanfile = self._get_deps_graph(reference, profile, filename, cwd, remote_proxy)
     installer = ConanInstaller(self._client_cache, self._user_io.out, remote_proxy, None)
     build_mode = BuildMode(build_modes, self._user_io.out)
     nodes = installer.nodes_to_build(deps_graph, build_mode)
     counter = Counter(ref.conan.name for ref, _ in nodes)
     ret = [ref if counter[ref.conan.name] > 1 else str(ref.conan) for ref, _ in nodes]
     return ret, self._get_project_reference(reference, conanfile)
示例#4
0
文件: manager.py 项目: 19317362/conan
 def info_nodes_to_build(self, reference, profile, build_modes, remote_name, check_updates):
     remote_proxy = self.get_proxy(remote_name=remote_name)
     deps_graph, _, conanfile = self._get_deps_graph(reference, profile, remote_proxy, update=False,
                                                     check_updates=check_updates)
     build_mode = BuildMode(build_modes, self._user_io.out)
     installer = ConanInstaller(self._client_cache, self._user_io.out, remote_proxy, build_mode,
                                None, recorder=self._recorder)
     nodes = installer.nodes_to_build(deps_graph)
     counter = Counter(ref.conan.name for ref, _ in nodes)
     ret = [ref if counter[ref.conan.name] > 1 else str(ref.conan) for ref, _ in nodes]
     return ret, self._get_project_reference(reference, conanfile)
示例#5
0
    def info(self,
             reference,
             current_path,
             profile,
             remote=None,
             info=None,
             filename=None,
             check_updates=False,
             build_order=None,
             build_modes=None,
             graph_filename=None,
             package_filter=None,
             show_paths=False):
        """ Fetch and build all dependencies for the given reference
        @param reference: ConanFileReference or path to user space conanfile
        @param current_path: where the output files will be saved
        @param remote: install only from that remote
        @param profile: Profile object with both the -s introduced options and profile readed values
        @param build_modes: List of build_modes specified
        @param filename: Optional filename of the conanfile

        """

        remote_proxy = ConanProxy(self._client_cache,
                                  self._user_io,
                                  self._remote_manager,
                                  remote,
                                  update=False,
                                  check_updates=check_updates)

        loader = ConanFileLoader(self._runner, self._client_cache.settings,
                                 profile)
        conanfile = self._get_conanfile_object(loader, reference, filename,
                                               current_path)
        graph_builder = self._get_graph_builder(loader, False, remote_proxy)
        deps_graph = graph_builder.load(conanfile)

        if build_order:
            result = deps_graph.build_order(build_order)
            self._user_io.out.info(", ".join(str(s) for s in result))
            return

        if build_modes is not None:
            installer = ConanInstaller(self._client_cache, self._user_io.out,
                                       remote_proxy, None)
            build_mode = BuildMode(build_modes, self._user_io.out)
            nodes = installer.nodes_to_build(deps_graph, build_mode)
            counter = Counter(ref.conan.name for ref, _ in nodes)
            self._user_io.out.info(", ".join(
                (str(ref) if counter[ref.conan.name] > 1 else str(ref.conan))
                for ref, _ in nodes))
            return

        if check_updates:
            graph_updates_info = graph_builder.get_graph_updates_info(
                deps_graph)
        else:
            graph_updates_info = {}

        def read_dates(deps_graph):
            ret = {}
            for ref, _ in sorted(deps_graph.nodes):
                if ref:
                    manifest = self._client_cache.load_manifest(ref)
                    ret[ref] = manifest.time_str
            return ret

        # Get project reference
        project_reference = None
        if isinstance(reference, ConanFileReference):
            project_reference = None
        else:
            project_reference = str(conanfile)

        # Print results
        if graph_filename:
            if graph_filename.endswith(".html"):
                grapher = ConanHTMLGrapher(project_reference, deps_graph)
            else:
                grapher = ConanGrapher(project_reference, deps_graph)
            grapher.graph_file(graph_filename)
        else:
            registry = RemoteRegistry(self._client_cache.registry,
                                      self._user_io.out)
            Printer(self._user_io.out).print_info(deps_graph,
                                                  project_reference, info,
                                                  registry,
                                                  graph_updates_info, remote,
                                                  read_dates(deps_graph),
                                                  self._client_cache,
                                                  package_filter, show_paths)