Skip to content
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
2 changes: 1 addition & 1 deletion conda_libmamba_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def _collect_all_metadata_spinner_message(
return (
f"Channels:\n"
f" - {canonical_names_dashed}\n"
f"Platform: {context.subdir}\n"
f"Platform: {next((s for s in self.subdirs if s != 'noarch'), context.subdir)}\n"
f"Collecting package metadata ({self._repodata_fn})"
)

Expand Down
20 changes: 20 additions & 0 deletions news/911-cross-platform-export-display
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Enhancements

* <news item>

### Bug fixes

* Show the target platform instead of the host platform in the progress
message during cross-platform lockfile export. (#911)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
47 changes: 47 additions & 0 deletions tests/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,53 @@ def test_pytorch_gpu(specs):
raise AssertionError("No pytorch found")


_CROSS_PLATFORM_TARGET = "linux-64" if context.subdir != "linux-64" else "win-64"


@pytest.mark.parametrize(
"subdirs,expected_platform",
(
pytest.param(
(_CROSS_PLATFORM_TARGET, "noarch"),
_CROSS_PLATFORM_TARGET,
id="cross-platform-target",
),
pytest.param(
("noarch",),
context.subdir,
id="noarch-only-fallback",
),
),
)
def test_cross_platform_spinner_message(
tmp_path: Path,
subdirs: tuple[str, ...],
expected_platform: str,
) -> None:
"""
https://github.com/conda/conda-libmamba-solver/pull/911

The ``Platform:`` line of the metadata-collection spinner message should
show the first non-``noarch`` entry of ``self.subdirs`` (the actual
target platform during cross-platform export) and fall back to
``context.subdir`` when ``self.subdirs`` only contains ``noarch``.
"""
from conda.models.channel import Channel

solver = Solver(
prefix=tmp_path,
channels=["conda-forge"],
specs_to_add=["tzdata"],
command="create",
)
# Assign after construction so the noarch-only case bypasses the
# ``next(s for s in self.subdirs if s != "noarch")`` call in ``__init__``.
solver.subdirs = subdirs
message = solver._collect_all_metadata_spinner_message(channels=[Channel("conda-forge")])
assert f"Platform: {expected_platform}" in message
assert "Platform: noarch" not in message


def test_channel_subdir_set_correctly(tmp_env: TmpEnvFixture) -> None:
"""
https://github.com/conda/conda-libmamba-solver/issues/662
Expand Down
Loading