Skip to content

Commit

Permalink
fixes for feature selection
Browse files Browse the repository at this point in the history
  • Loading branch information
bryevdv committed Mar 6, 2013
1 parent 42747a0 commit ee80957
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions conda/planners.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ def _replace_with_features(conda, all_pkgs, track_features, env_constraints):

all_pkgs_dict = {}
for pkg in all_pkgs:
all_pkgs_dict[pkg.name] = [pkg]
all_pkgs_dict[pkg.name] = pkg

for pkg in all_pkgs:
for feature in pkg.features:
Expand All @@ -708,20 +708,26 @@ def _replace_with_features(conda, all_pkgs, track_features, env_constraints):
rpkgs = idx.find_matches(env_constraints, rpkgs)
rpkgs = channel_select(rpkgs, conda.channel_urls)
rpkg = newest_packages(rpkgs)
if not rpkg:
raise RuntimeError("cannot find package '%s' without feature '%s'" % (name, feature))
results.add(rpkg.pop())

for feature, fpkgs in track_features.items():
for name in fpkgs:

for feature in track_features:
fnames = set([pkg.name for pkg in idx.lookup_from_feature(feature)])
for name in fnames:
if name in all_pkgs_dict:
pkg = all_pkgs_dict[name]
if feature in pkg.features: continue
results.remove(pkg)
spec = make_package_spec("%s %s" % (pkg.name, pkg.version.vstring))
rpkgs = idx.find_compatible_packages(set([specs]))
rpkgs = idx.find_compatible_packages(set([spec]))
rpkgs = [pkg for pkg in rpkgs if feature in pkg.features]
rpkgs = idx.find_matches(env_constraints, rpkgs)
rpkgs = channel_select(rpkgs, conda.channel_urls)
rpkg = newest_packages(rpkgs)
if not rpkg:
raise RuntimeError("cannot find package '%s' with feature '%s'" % (name, feature))
results.add(rpkg.pop())

return results
Expand Down

0 comments on commit ee80957

Please sign in to comment.