1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: Add conda.

* gnu/packages/patches/conda-fix-plugin-settings-test.patch: New file.
* gnu/packages/patches/conda-fix-cross-platform-export-tests.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add reference to them.
* gnu/packages/package-management.scm (conda): New variable.

Change-Id: I77335397e51a2b309567721151940e4207643911
This commit is contained in:
Danny Milosavljevic
2025-12-14 21:03:28 +01:00
parent d11b25b96a
commit a3a998141b
4 changed files with 183 additions and 0 deletions

View File

@@ -1131,6 +1131,8 @@ dist_patch_DATA = \
%D%/packages/patches/combinatorial-blas-io-fix.patch \
%D%/packages/patches/composable-kernel-conditional-kernels.patch \
%D%/packages/patches/compsize-fix-btrfs-progs-compatibility.patch \
%D%/packages/patches/conda-fix-cross-platform-export-tests.patch \
%D%/packages/patches/conda-fix-plugin-settings-test.patch \
%D%/packages/patches/containerd-create-pid-file.patch \
%D%/packages/patches/containerd-fix-includes.patch \
%D%/packages/patches/cool-retro-term-wctype.patch \

View File

@@ -1480,7 +1480,17 @@ manage (install/update) them for you.")
;; XXX: Issues salad: network access, can't detect Conda
;; environemnt, assertion failed; review if they may be
;; fixed.
;;
;; test_info_all: Fails due to parallel test interference.
;; test_notices_appear_once_when_running_decorated_commands
;; creates and deletes an environment named "notices_test".
;; When test_info_all runs in parallel, it invokes
;; "conda info --envs" (sees notices_test), then the other
;; test deletes it, then test_info_all invokes
;; "conda info --all" (doesn't see notices_test). The
;; assertion that these outputs match fails.
(list "not test_PrefixData_return_value_contract"
"test_info_all"
"test__get_python_info"
"test_auto_update_conda"
"test_build_version_shows_as_changed "
@@ -1896,6 +1906,41 @@ enabling fast package management functionality in Python applications.")
Conda based on the libmamba library. It significantly speeds up dependency
resolution compared to the classic solver.")
(license license:bsd-3)))
(define-public conda
(package
(inherit conda-bootstrap)
(name "conda")
(version "25.9.1")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/conda/conda")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "1s8xxc8rfayfq6p3iwgp9v3hbanp30ciw7cznppn1qk1l9fy7nxj"))
(patches
(search-patches "conda-fix-plugin-settings-test.patch"
"conda-fix-cross-platform-export-tests.patch"))))
(arguments
(substitute-keyword-arguments (package-arguments conda-bootstrap)
((#:phases phases)
#~(modify-phases #$phases
;; Remove the patch that forces classic solver - we have libmamba
(delete 'set-default-solver-to-classic)
;; Replace pre-check to not force classic solver
(replace 'pre-check
(lambda _
(setenv "HOME" "/tmp")
;; Prevent tests from writing package cache to the output
;; directory, which would cause non-reproducible builds.
(setenv "CONDA_PKGS_DIRS" "/tmp/conda-pkgs")))))))
(propagated-inputs
(modify-inputs (package-propagated-inputs conda-bootstrap)
(prepend python-conda-libmamba-solver)))))
(define-public conan
(package
(name "conan")

View File

@@ -0,0 +1,57 @@
Author: Danny Milosavljevic <dannym@friendly-machines.com>
Date: Sun Dec 14 09:26:14 PM CET 2025
Subject: Fix cross-platform export tests to work offline.
SPDX-License-Identifier: BSD-3-Clause
These tests need channels configured to resolve packages for other platforms.
Without channels, the libmamba solver crashes with IndexError on empty repos.
This patch adds the local conda_format_repo test channel to these tests,
allowing them to work without network access.
diff --git a/tests/cli/test_main_export.py b/tests/cli/test_main_export.py
index 1234567..abcdefg 100644
--- a/tests/cli/test_main_export.py
+++ b/tests/cli/test_main_export.py
@@ -848,6 +848,7 @@ def test_export_platform_argument(
def test_export_multiple_platforms(
conda_cli: CondaCLIFixture,
+ conda_format_repo_channel,
plugin_manager_with_exporters: CondaPluginManager,
tmp_path: Path,
) -> None:
@@ -874,6 +875,7 @@ def test_export_multiple_platforms(
def test_export_single_platform_different_platform(
conda_cli: CondaCLIFixture,
+ conda_format_repo_channel,
tmp_path: Path,
plugin_manager_with_exporters: CondaPluginManager,
):
diff --git a/tests/conftest.py b/tests/conftest.py
index 1234567..abcdefg 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -75,6 +75,22 @@ def test_recipes_channel(mocker: MockerFixture) -> Path:
return TEST_RECIPES_CHANNEL
+CONDA_FORMAT_REPO = Path(__file__).parent / "data" / "conda_format_repo"
+
+
+@pytest.fixture
+def conda_format_repo_channel(mocker: MockerFixture) -> Path:
+ """Set up conda_format_repo as the channel for tests needing multi-platform data."""
+ mocker.patch(
+ "conda.base.context.Context.channels",
+ new_callable=mocker.PropertyMock,
+ return_value=(channel_str := str(CONDA_FORMAT_REPO),),
+ )
+ reset_context()
+ assert context.channels == (channel_str,)
+ return CONDA_FORMAT_REPO
+
+
@pytest.fixture
def wheelhouse() -> Path:
"""Return the path to the directory containing pre-built wheel files used in tests."""

View File

@@ -0,0 +1,79 @@
From 39ea25ff598cfd52e0cac37525a44dbf6590b800 Mon Sep 17 00:00:00 2001
From: Travis Hathaway <travis.j.hathaway@gmail.com>
Date: Mon, 29 Sep 2025 15:22:44 +0200
SPDX-License-Identifier: BSD-3-Clause
Subject: [PATCH 1/2] removing this test because it we are adding a setting to
conda-libmamba-solver
---
tests/plugins/test_settings.py | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/tests/plugins/test_settings.py b/tests/plugins/test_settings.py
index 05196c5c09b..27b9fcf70c1 100644
--- a/tests/plugins/test_settings.py
+++ b/tests/plugins/test_settings.py
@@ -326,23 +326,6 @@ def test_conda_config_describe_includes_plugin_settings(
assert f"plugins.{MAP_PARAMETER_NAME}:" in out
-def test_conda_config_describe_not_included_without_plugins(conda_cli):
- """
- Ensure that the describe command does not include the section banner
- for plugins when no additional settings are provided by plugins
- """
- out, err, _ = conda_cli("config", "--describe")
-
- section_banner = (
- "# ######################################################\n"
- "# ## Additional settings provided by plugins ##\n"
- "# ######################################################"
- )
-
- assert not err
- assert section_banner not in out
-
-
def test_conda_config_describe_unknown_plugin_setting(
condarc_plugin_manager, conda_cli
):
From 7254151456ad201bfc1ead8ab48a509c4e9a7319 Mon Sep 17 00:00:00 2001
From: Travis Hathaway <travis.j.hathaway@gmail.com>
Date: Mon, 29 Sep 2025 17:09:01 +0200
Subject: [PATCH 2/2] using a mock to fix test instead of removing it
---
tests/plugins/test_settings.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tests/plugins/test_settings.py b/tests/plugins/test_settings.py
index 27b9fcf70c1..eb5200eb105 100644
--- a/tests/plugins/test_settings.py
+++ b/tests/plugins/test_settings.py
@@ -326,6 +326,25 @@ def test_conda_config_describe_includes_plugin_settings(
assert f"plugins.{MAP_PARAMETER_NAME}:" in out
+def test_conda_config_describe_not_included_without_plugins(conda_cli, mocker):
+ """
+ Ensure that the describe command does not include the section banner
+ for plugins when no additional settings are provided by plugins
+ """
+ mock = mocker.patch("conda.plugins.manager.CondaPluginManager.get_hook_results")
+ mock.return_value = []
+ out, err, _ = conda_cli("config", "--describe")
+
+ section_banner = (
+ "# ######################################################\n"
+ "# ## Additional settings provided by plugins ##\n"
+ "# ######################################################"
+ )
+
+ assert not err
+ assert section_banner not in out
+
+
def test_conda_config_describe_unknown_plugin_setting(
condarc_plugin_manager, conda_cli
):