Skip to content

Commit

Permalink
Limit impact of solver in broken environments
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg1969 committed Feb 28, 2016
1 parent 2d6a70d commit 13ca901
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
5 changes: 3 additions & 2 deletions conda/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,11 @@ def install_actions(prefix, index, specs, force=False, only_names=None,
if config.track_features:
specs.extend(x + '@' for x in config.track_features)

for fn in r.install(specs, [d + '.tar.bz2' for d in linked], update_deps=update_deps):
pkgs = r.install(specs, [d + '.tar.bz2' for d in linked], update_deps=update_deps)
for fn in pkgs:
dist = fn[:-8]
name = install.name_dist(dist)
if only_names and name not in only_names:
if not name or only_names and name not in only_names:
continue
must_have[name] = dist

Expand Down
26 changes: 13 additions & 13 deletions conda/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,25 +801,25 @@ def install_specs(self, specs, installed, update_deps=True):
specs = list(map(MatchSpec, specs))
snames = {s.name for s in specs}
log.debug('Checking satisfiability of current install')
bad_specs = self.bad_installed(installed, specs)
use_pkgs = self.bad_installed(installed, specs)
preserve = []
for pkg in installed:
assert pkg in self.index
name, version, build = self.package_triple(pkg)
if name in snames:
continue
if use_pkgs and name not in use_pkgs:
preserve.append(pkg)
continue
# If update_deps=True, set the target package in MatchSpec so that
# the solver can minimize the version change. If update_deps=False,
# fix the version and build so that no change is possible.
need_help = name in bad_specs
if need_help:
preserve.append(pkg)
if update_deps or need_help:
spec = MatchSpec(name, target=pkg, optional=need_help)
if update_deps:
spec = MatchSpec(name, target=pkg)
else:
spec = MatchSpec(' % s %s %s' % (name, version, build))
specs.append(spec)
return specs, bad_specs
return specs, preserve

def install(self, specs, installed=None, update_deps=True, returnall=False):
len0 = len(specs)
Expand All @@ -831,15 +831,15 @@ def install(self, specs, installed=None, update_deps=True, returnall=False):
def remove_specs(self, specs, installed):
specs = [MatchSpec(s, optional=True, negate=True) for s in specs]
snames = {s.name for s in specs}
bad_specs = self.bad_installed(installed, specs)
bad_env = bool(self.bad_installed(installed, specs))
preserve = []
for pkg in installed:
assert pkg in self.index
name, version, build = self.package_triple(pkg)
if name in bad_specs and name not in snames:
if self.package_name(pkg) in snames:
continue
elif bad_env:
preserve.append(pkg)
if name not in snames:
specs.append(MatchSpec(name, optional=True, target=pkg))
else:
specs.append(MatchSpec(self.package_name(pkg), optional=True, target=pkg))
return specs, preserve

def remove(self, specs, installed):
Expand Down

0 comments on commit 13ca901

Please sign in to comment.