Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore virtual packages when checking environment consistency #10196

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion conda/resolve.py
Expand Up @@ -911,7 +911,9 @@ def gen_clauses(self):
for prec in itervalues(self.index):
nkey = C.Not(self.to_sat_name(prec))
for ms in self.ms_depends(prec):
C.Require(C.Or, nkey, self.push_MatchSpec(C, ms))
# Virtual packages can't be installed, we ignore them
if not ms.name.startswith('__'):
C.Require(C.Or, nkey, self.push_MatchSpec(C, ms))

if log.isEnabledFor(DEBUG):
log.debug("gen_clauses returning with clause count: %d", C.get_clause_count())
Expand Down
15 changes: 13 additions & 2 deletions tests/core/test_solve.py
Expand Up @@ -241,9 +241,20 @@ def test_virtual_package_solver(tmpdir):

with env_var('CONDA_OVERRIDE_CUDA', '10.0'):
with get_solver_cuda(tmpdir, specs) as solver:
final_state = solver.solve_final_state()
_ = solver.solve_final_state()
ssc = solver.ssc
# Check the cuda virtual package is included in the solver
assert '__cuda' in solver.ssc.specs_map.keys()
assert '__cuda' in ssc.specs_map.keys()

# Check that the environment is consistent after installing a
# package which *depends* on a virtual package
for pkgs in ssc.solution_precs:
if pkgs.name == 'cudatoolkit':
# make sure this package depends on the __cuda virtual
# package as a dependency since this is requirement of the
# test the test
assert '__cuda' in pkgs.depends[0]
assert ssc.r.bad_installed(ssc.solution_precs, ())[1] is None


def test_cuda_1(tmpdir):
Expand Down