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

BUG make sure to munge specs like conda-build before checking w/ rattler #45

Merged
merged 1 commit into from
Jun 10, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions conda_forge_feedstock_check_solvable/rattler_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from conda_forge_feedstock_check_solvable.utils import (
DEFAULT_RUN_EXPORTS,
convert_spec_to_conda_build,
get_run_exports,
print_debug,
print_warning,
Expand Down Expand Up @@ -96,8 +97,12 @@ def solve(
run_exports = copy.deepcopy(DEFAULT_RUN_EXPORTS)

try:
_specs = [MatchSpec(s) for s in specs]
_constraints = [MatchSpec(c) for c in constraints] if constraints else None
_specs = [MatchSpec(convert_spec_to_conda_build(s)) for s in specs]
_constraints = (
[MatchSpec(convert_spec_to_conda_build(c)) for c in constraints]
if constraints
else None
)

print_debug(
"RATTLER running solver for specs \n\n%s\n", pprint.pformat(_specs)
Expand Down Expand Up @@ -130,14 +135,16 @@ def solve(
)

except Exception as e:
__specs = [convert_spec_to_conda_build(s) for s in specs]
__constraints = [convert_spec_to_conda_build(s) for s in constraints or []]
err = str(e)
print_warning(
"RATTLER failed to solve specs \n\n%s\n\nwith "
"constraints \n\n%s\n\nfor channels "
"\n\n%s\n\non platform "
"\n\n%s\n\nThe reported errors are:\n\n%s\n",
textwrap.indent(pprint.pformat(specs), " "),
textwrap.indent(pprint.pformat(constraints), " "),
textwrap.indent(pprint.pformat(__specs), " "),
textwrap.indent(pprint.pformat(__constraints), " "),
textwrap.indent(pprint.pformat(self.channels), " "),
textwrap.indent(pprint.pformat(self.platform_arch), " "),
textwrap.indent(err, " "),
Expand Down
33 changes: 33 additions & 0 deletions tests/test_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,36 @@ def test_solvers_python(mamba_factory, rattler_factory):
)
assert set(mamba_solution or []) == set(rattler_solution or [])
assert mamba_solvable == rattler_solvable


def test_solvers_python3_pin(solver_factory):
specs = [
"tetgen",
"hdf5",
"libgfortran5 >=12.3.0",
"triangle",
"scipy",
"numpy",
"pytest-xdist",
"ncurses",
"pychrono >=7",
"cython",
"h5py * mpi_mpich_*",
"petsc4py",
"future",
"mpi4py",
"pytest",
"libgcc-ng >=12",
"h5py",
"openblas",
"python 3",
"hdf5 * mpi_mpich_*",
"libgfortran-ng",
"matplotlib-base",
"libstdcxx-ng >=12",
]
channels = (virtual_package_repodata(), "conda-forge")
platform = "linux-64"
solver = solver_factory(channels, platform)
solvable, err, solution = solver.solve(specs)
assert solvable, (err, solution)
Loading