Skip to content

Commit

Permalink
clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Sep 23, 2024
1 parent 9bdc3c0 commit 9a7dba7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
2 changes: 0 additions & 2 deletions conda_libmamba_solver/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,12 @@ def reload_local_channels(self):
"""
for noauth_url, info in self._index.items():
if noauth_url.startswith("file://") or info.channel.scheme == "file":
print("Reloading", noauth_url)
url, json_path = self._fetch_channel(info.full_url)
repo_position = self._repos.index(info.repo)
info.repo.clear(True)
new = self._json_path_to_repo_info(url, json_path, try_solv=False)
self._repos[repo_position] = new.repo
self._index[noauth_url] = new
print("Reloaded")
time.sleep(1)
set_channel_priorities(self._index)

Expand Down
34 changes: 10 additions & 24 deletions conda_libmamba_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,11 @@ def solve_final_state(
# Aggregate channels and subdirs
deduped_channels = {}
for channel in all_channels:
if (
channel_platform := getattr(channel, "platform", None)
):
if channel_platform := getattr(channel, "platform", None):
if channel_platform not in subdirs:
log.warning(
"Channel %s defines subdir %s which is not part of subdirs=%s. Ignoring...",
log.info(
"Channel %s defines platform %s which is not part of subdirs=%s. "
"Ignoring platform attribute...",
channel,
channel_platform,
subdirs,
Expand All @@ -216,24 +215,15 @@ def solve_final_state(
# our explicitly passed subdirs if .platform is defined!
channel = Channel(**{k: v for k, v in channel.dump().items() if k != "platform"})
deduped_channels[channel] = None
for c in all_channels:
print(c)
for url in c.urls(with_credentials=False, subdirs=subdirs):
print(" >", url)
print("---")
deduped_channels = tuple(dict.fromkeys(all_channels))
for c in deduped_channels:
print(c)
for url in c.urls(with_credentials=False, subdirs=subdirs):
print(" >", url)
all_channels = tuple(deduped_channels)
with Spinner(
self._spinner_msg_metadata(deduped_channels, conda_bld_channels=conda_bld_channels),
self._spinner_msg_metadata(all_channels, conda_bld_channels=conda_bld_channels),
enabled=not context.verbosity and not context.quiet,
json=context.json,
):
index = IndexHelper(
installed_records=(*in_state.installed.values(), *in_state.virtual.values()),
channels=deduped_channels,
channels=all_channels,
subdirs=subdirs,
repodata_fn=self._repodata_fn,
load_pkgs_cache=context.offline,
Expand All @@ -260,14 +250,10 @@ def solve_final_state(

def _spinner_msg_metadata(self, channels: Iterable[Channel], conda_bld_channels=()):
if self._called_from_conda_build():
msg = "[DEV] Reloading output folder"
msg = "Reloading output folder"
if conda_bld_channels:
urls = [
url
for c in conda_bld_channels
for url in Channel(c).urls(with_credentials=False, subdirs=self.subdirs)
]
msg += f" ({', '.join(urls)})"
names = [Channel(c).canonical_name for c in conda_bld_channels]
msg += f" ({', '.join(names)})"
return msg
canonical_names = list(dict.fromkeys([c.canonical_name for c in channels]))
canonical_names_dashed = "\n - ".join(canonical_names)
Expand Down

0 comments on commit 9a7dba7

Please sign in to comment.