From 0f16735188478bb989e14192662cbd3d79a74f2b Mon Sep 17 00:00:00 2001 From: John Costa Date: Wed, 15 Apr 2026 19:50:34 -0700 Subject: [PATCH 1/5] fix: show target platform instead of host in cross-platform export The progress message during cross-platform lockfile export always displayed context.subdir (the host platform) instead of the actual target platform being solved. Use self.subdirs to display the correct target, matching the pattern already used for init_libmamba_context. Fixes conda/conda#15920 --- conda_libmamba_solver/solver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_libmamba_solver/solver.py b/conda_libmamba_solver/solver.py index bc7ae4a5..ee5018d2 100644 --- a/conda_libmamba_solver/solver.py +++ b/conda_libmamba_solver/solver.py @@ -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')}\n" f"Collecting package metadata ({self._repodata_fn})" ) From dfe08cbf7a4ab40c7812dbf299ccfe468c3b85bf Mon Sep 17 00:00:00 2001 From: John Costa Date: Sat, 18 Apr 2026 12:09:07 -0700 Subject: [PATCH 2/5] fix: guard cross-platform export spinner against noarch-only subdirs --- conda_libmamba_solver/solver.py | 2 +- news/911-cross-platform-export-display | 20 +++++++++++ tests/test_solver.py | 47 ++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 news/911-cross-platform-export-display diff --git a/conda_libmamba_solver/solver.py b/conda_libmamba_solver/solver.py index ee5018d2..83229d31 100644 --- a/conda_libmamba_solver/solver.py +++ b/conda_libmamba_solver/solver.py @@ -209,7 +209,7 @@ def _collect_all_metadata_spinner_message( return ( f"Channels:\n" f" - {canonical_names_dashed}\n" - f"Platform: {next(s for s in self.subdirs if s != 'noarch')}\n" + f"Platform: {next((s for s in self.subdirs if s != 'noarch'), context.subdir)}\n" f"Collecting package metadata ({self._repodata_fn})" ) diff --git a/news/911-cross-platform-export-display b/news/911-cross-platform-export-display new file mode 100644 index 00000000..c74eee17 --- /dev/null +++ b/news/911-cross-platform-export-display @@ -0,0 +1,20 @@ +### Enhancements + +* + +### Bug fixes + +* Show the target platform instead of the host platform in the progress + message during cross-platform lockfile export. (#911) + +### Deprecations + +* + +### Docs + +* + +### Other + +* diff --git a/tests/test_solver.py b/tests/test_solver.py index eedc91cf..fb8658f3 100644 --- a/tests/test_solver.py +++ b/tests/test_solver.py @@ -657,6 +657,53 @@ def test_pytorch_gpu(specs): raise AssertionError("No pytorch found") +def test_cross_platform_spinner_shows_target_platform(tmp_path: Path) -> None: + """ + https://github.com/conda/conda-libmamba-solver/pull/911 + + When ``subdirs`` is set to a non-host platform, the ``Platform:`` line of + the metadata-collection spinner message should show the target platform, + not the host platform, and must never show ``noarch``. + """ + from conda.models.channel import Channel + + target = "linux-64" if context.subdir != "linux-64" else "win-64" + solver = Solver( + prefix=tmp_path, + channels=["conda-forge"], + subdirs=(target, "noarch"), + specs_to_add=["tzdata"], + command="create", + ) + message = solver._collect_all_metadata_spinner_message( + channels=[Channel("conda-forge")] + ) + assert f"Platform: {target}" in message + assert "Platform: noarch" not in message + + +def test_cross_platform_spinner_falls_back_when_only_noarch(tmp_path: Path) -> None: + """ + https://github.com/conda/conda-libmamba-solver/pull/911 + + If ``self.subdirs`` only contains ``noarch`` the spinner message must not + raise ``StopIteration``; it should fall back to ``context.subdir``. + """ + from conda.models.channel import Channel + + solver = Solver( + prefix=tmp_path, + channels=["conda-forge"], + specs_to_add=["tzdata"], + command="create", + ) + solver.subdirs = ("noarch",) + message = solver._collect_all_metadata_spinner_message( + channels=[Channel("conda-forge")] + ) + assert f"Platform: {context.subdir}" in message + + def test_channel_subdir_set_correctly(tmp_env: TmpEnvFixture) -> None: """ https://github.com/conda/conda-libmamba-solver/issues/662 From 47b576baa891e2f42d116842775b6fbd4b241bce Mon Sep 17 00:00:00 2001 From: John Costa Date: Sat, 18 Apr 2026 13:02:45 -0700 Subject: [PATCH 3/5] style: apply ruff format --- tests/test_solver.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/test_solver.py b/tests/test_solver.py index fb8658f3..01a93397 100644 --- a/tests/test_solver.py +++ b/tests/test_solver.py @@ -675,9 +675,7 @@ def test_cross_platform_spinner_shows_target_platform(tmp_path: Path) -> None: specs_to_add=["tzdata"], command="create", ) - message = solver._collect_all_metadata_spinner_message( - channels=[Channel("conda-forge")] - ) + message = solver._collect_all_metadata_spinner_message(channels=[Channel("conda-forge")]) assert f"Platform: {target}" in message assert "Platform: noarch" not in message @@ -698,9 +696,7 @@ def test_cross_platform_spinner_falls_back_when_only_noarch(tmp_path: Path) -> N command="create", ) solver.subdirs = ("noarch",) - message = solver._collect_all_metadata_spinner_message( - channels=[Channel("conda-forge")] - ) + message = solver._collect_all_metadata_spinner_message(channels=[Channel("conda-forge")]) assert f"Platform: {context.subdir}" in message From 16e15fff3a707daafbce9e501ea010bf7461445c Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 24 Apr 2026 10:39:40 +0200 Subject: [PATCH 4/5] test: parameterize cross-platform spinner message test Combines the cross-platform target and noarch-only fallback cases into a single parameterized test to reduce duplication. --- tests/test_solver.py | 56 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/tests/test_solver.py b/tests/test_solver.py index 01a93397..b2357849 100644 --- a/tests/test_solver.py +++ b/tests/test_solver.py @@ -657,35 +657,36 @@ def test_pytorch_gpu(specs): raise AssertionError("No pytorch found") -def test_cross_platform_spinner_shows_target_platform(tmp_path: Path) -> None: - """ - https://github.com/conda/conda-libmamba-solver/pull/911 +_CROSS_PLATFORM_TARGET = "linux-64" if context.subdir != "linux-64" else "win-64" - When ``subdirs`` is set to a non-host platform, the ``Platform:`` line of - the metadata-collection spinner message should show the target platform, - not the host platform, and must never show ``noarch``. - """ - from conda.models.channel import Channel - target = "linux-64" if context.subdir != "linux-64" else "win-64" - solver = Solver( - prefix=tmp_path, - channels=["conda-forge"], - subdirs=(target, "noarch"), - specs_to_add=["tzdata"], - command="create", - ) - message = solver._collect_all_metadata_spinner_message(channels=[Channel("conda-forge")]) - assert f"Platform: {target}" in message - assert "Platform: noarch" not in message - - -def test_cross_platform_spinner_falls_back_when_only_noarch(tmp_path: Path) -> None: +@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 - If ``self.subdirs`` only contains ``noarch`` the spinner message must not - raise ``StopIteration``; it should fall back to ``context.subdir``. + 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 @@ -695,9 +696,12 @@ def test_cross_platform_spinner_falls_back_when_only_noarch(tmp_path: Path) -> N specs_to_add=["tzdata"], command="create", ) - solver.subdirs = ("noarch",) + # 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: {context.subdir}" in message + assert f"Platform: {expected_platform}" in message + assert "Platform: noarch" not in message def test_channel_subdir_set_correctly(tmp_env: TmpEnvFixture) -> None: From 90a1af129b3c2fb8c5dbd6a910555eeb6df13dd8 Mon Sep 17 00:00:00 2001 From: John Costa Date: Sat, 25 Apr 2026 17:47:17 -0700 Subject: [PATCH 5/5] ci: retrigger after upstream aarch64 unblock