Skip to content

Commit

Permalink
do not allow conflicting history specs to be uninstalled
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Oct 30, 2023
1 parent 52b84ac commit f093222
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions conda_libmamba_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,16 @@ def _specs_to_tasks_add(self, in_state: SolverInputState, out_state: SolverOutpu
elif name == "python" and installed and not pinned:
pyver = ".".join(installed.version.split(".")[:2])
tasks[("ADD_PIN", api.SOLVER_NOOP)].append(f"python {pyver}.*")
elif history and not history.is_name_only_spec and not conflicting:
tasks[("ADD_PIN", api.SOLVER_NOOP)].append(self._spec_to_str(history))
elif history and not history.is_name_only_spec:
if conflicting:
# deliberately ignore conflicts that appear in history
# because we want to _keep_ this conflicting package!
# by `pass`ing here we won't run the code below that would otherwise
# result in an ALLOW_UNINSTALL, which would tell the solver is ok to remove
# this package, which was explicitly requested by the user in past operations
pass
else:
tasks[("ADD_PIN", api.SOLVER_NOOP)].append(self._spec_to_str(history))
elif installed:
if conflicting:
tasks[("ALLOW_UNINSTALL", api.SOLVER_ALLOWUNINSTALL)].append(name)
Expand Down

0 comments on commit f093222

Please sign in to comment.