Skip to content

Commit

Permalink
Under some rare (and as of yet undetermined conditions virtual pacakg…
Browse files Browse the repository at this point in the history
…es can make their way into the compute_final_precs function. (#2424)

Safely ignore virtual pacakges in compute_final_precs
Co-authored-by: Johan Mabille <[email protected]>
  • Loading branch information
mariusvniekerk authored Apr 5, 2023
1 parent 22d37ce commit 1a1981a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions mamba/mamba/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,18 @@ def compute_final_precs(
entry["channel"].platform_url(entry["platform"], with_credentials=False)
] = entry

i_rec: PackageRecord
for _, pkg in to_unlink:
for i_rec in installed_pkg_recs:
if i_rec.fn == pkg:
final_precs.remove(i_rec)
to_unlink_records.append(i_rec)
try:
final_precs.remove(i_rec)
to_unlink_records.append(i_rec)
except KeyError:
# virtual packages cannot be unlinked as they do not exist
if i_rec.package_type == "virtual_system":
continue
raise
break
else:
print("No package record found!")
Expand All @@ -391,6 +398,10 @@ def compute_final_precs(
if ipkg.name == rec.name:
rec.noarch = ipkg.noarch

# virtual packages cannot be linked as they do not exist
if rec.package_type == "virtual_system":
continue

final_precs.add(rec)
to_link_records.append(rec)

Expand Down

0 comments on commit 1a1981a

Please sign in to comment.