Skip to content

Commit

Permalink
fixed inefficiency in 'conan info' (#16236)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored May 13, 2024
1 parent b7f925b commit 230aa52
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions conans/client/conan_command_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from conans.client.installer import build_id
from conans.client.printer import Printer
from conans.model.ref import ConanFileReference, PackageReference
from conans.paths import CONAN_MANIFEST
from conans.paths.package_layouts.package_editable_layout import PackageEditableLayout
from conans.search.binary_html_table import html_binary_graph
from conans.util.dates import iso8601_to_str
from conans.util.dates import iso8601_to_str, timestamp_to_str
from conans.util.files import save
from conans import __version__ as client_version
from conans.util.misc import make_tuple
Expand Down Expand Up @@ -85,11 +86,13 @@ def date_handler(obj):

def _read_dates(self, deps_graph):
ret = {}
for node in sorted(deps_graph.nodes):
for node in deps_graph.nodes:
ref = node.ref
if node.recipe not in (RECIPE_CONSUMER, RECIPE_VIRTUAL, RECIPE_EDITABLE):
manifest = self._cache.package_layout(ref).recipe_manifest()
ret[ref] = manifest.time_str
manifest = os.path.join(self._cache.package_layout(ref).export(), CONAN_MANIFEST)
with open(manifest, 'r', encoding="utf-8") as f:
first_line = f.readline().strip('\n')
ret[ref] = timestamp_to_str(int(first_line))
return ret

def nodes_to_build(self, nodes_to_build):
Expand Down Expand Up @@ -121,6 +124,7 @@ def _grab_info_data(self, deps_graph, grab_paths):
remotes = self._cache.registry.load_remotes()
ret = []

node_times = self._read_dates(deps_graph)
for (ref, package_id), list_nodes in compact_nodes.items():
node = list_nodes[0]
if node.recipe == RECIPE_VIRTUAL:
Expand Down Expand Up @@ -203,7 +207,6 @@ def _add_if_exists(attrib, as_list=False):
if node.binary_remote:
item_data["binary_remote"] = node.binary_remote.name

node_times = self._read_dates(deps_graph)
if node_times and node_times.get(ref, None):
item_data["creation_date"] = node_times.get(ref, None)

Expand Down

0 comments on commit 230aa52

Please sign in to comment.