def remove_actions(prefix, specs, index=None, pinned=True): linked = install.linked(prefix) mss = [MatchSpec(spec) for spec in specs] if index: r = Resolve(index) else: r = None pinned_specs = get_pinned_specs(prefix) actions = defaultdict(list) actions[inst.PREFIX] = prefix for dist in sorted(linked): fn = dist + '.tar.bz2' if any(ms.match(fn) for ms in mss): if pinned and any(MatchSpec(spec).match('%s.tar.bz2' % dist) for spec in pinned_specs): raise RuntimeError("Cannot remove %s because it is pinned. Use --no-pin to override." % dist) actions[inst.UNLINK].append(dist) if r and fn in index and r.track_features(fn): features_actions = remove_features_actions(prefix, index, r.track_features(fn)) for action in features_actions: if isinstance(actions[action], list): for item in features_actions[action]: if item not in actions[action]: actions[action].append(item) else: assert actions[action] == features_actions[action] return actions
def remove_features_actions(prefix, index, features): linked = install.linked(prefix) r = Resolve(index) actions = defaultdict(list) actions[inst.PREFIX] = [prefix] _linked = [d + '.tar.bz2' for d in linked] to_link = [] for dist in sorted(linked): fn = dist + '.tar.bz2' if fn not in index: continue if r.track_features(fn).intersection(features):
def remove_features_actions(prefix, index, features): linked = install.linked(prefix) r = Resolve(index) actions = defaultdict(list) actions[PREFIX] = prefix _linked = [d + '.tar.bz2' for d in linked] to_link = [] for dist in sorted(linked): fn = dist + '.tar.bz2' if fn not in index: continue if r.track_features(fn).intersection(features): actions[UNLINK].append(dist) if r.features(fn).intersection(features): actions[UNLINK].append(dist) subst = r.find_substitute(_linked, features, fn) if subst: to_link.append(subst[:-8]) if to_link: actions.update(ensure_linked_actions(to_link, prefix)) return actions
def solve(specs: List[str], r: Resolve) -> Union[bool, Iterable[str]]: features = set() # type: Set for spec in specs: if conda.config.platform == 'win32' and spec == 'python': continue # XXX: This does not work when a spec only contains the name, # and different versions of the package have different features. ms = MatchSpec(spec) for pkg in r.get_pkgs(ms, max_only=False): fn = pkg.fn features.update(r.track_features(fn)) for spec in specs: for pkg in r.get_pkgs(MatchSpec(spec), max_only=False): fn = pkg.fn r.update_with_features(fn, features) print("Solving package specifications: ", end='') try: return r.explicit(specs) or r.solve2(specs, features, installed=(), minimal_hint=False, guess=False, unsat_only=True) except RuntimeError: print('\n') return False
<<<<<<< HEAD <<<<<<< HEAD >>>>>>> origin/feature/instruction-arguments ======= <<<<<<< HEAD >>>>>>> princeofdarkness76/feature/instruction-arguments ======= >>>>>>> conda/feature/instruction-arguments >>>>>>> princeofdarkness76/conda ======= >>>>>>> origin/feature/instruction-arguments ======= >>>>>>> princeofdarkness76/feature/instruction-arguments ======= >>>>>>> origin/feature/instruction-arguments if r and fn in index and r.track_features(fn): features_actions = remove_features_actions( prefix, index, r.track_features(fn)) for action in features_actions: if isinstance(actions[action], list): for item in features_actions[action]: if item not in actions[action]: actions[action].append(item) else: assert actions[action] == features_actions[action] return actions def remove_features_actions(prefix, index, features): linked = install.linked(prefix)