From b95f5a2fed749f7fe5154927620457385b0292f8 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 16 Jun 2026 11:40:41 -0400 Subject: Passing the conda installation directory to delivery_conda_enable isn't necessary * The delivery context already provides this path --- src/lib/delivery/delivery_conda.c | 15 ++++++++------- src/lib/delivery/include/delivery.h | 3 +-- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/lib') diff --git a/src/lib/delivery/delivery_conda.c b/src/lib/delivery/delivery_conda.c index 12eddb7..4f2920e 100644 --- a/src/lib/delivery/delivery_conda.c +++ b/src/lib/delivery/delivery_conda.c @@ -103,18 +103,14 @@ void delivery_install_conda(char *install_script, char *conda_install_dir) { } } -void delivery_conda_enable(struct Delivery *ctx, char *conda_install_dir) { +void delivery_conda_enable(struct Delivery *ctx) { setenv("MAMBA_ROOT_PREFIX", ctx->storage.conda_install_prefix, 1); - if (conda_activate(conda_install_dir, "base")) { - SYSERROR("conda activation failed"); - exit(1); - } // Setting the CONDARC environment variable appears to be the only consistent // way to make sure the file is used. Not setting this variable leads to strange // behavior, especially if a conda environment is already active when STASIS is loaded. char rcpath[PATH_MAX]; - snprintf(rcpath, sizeof(rcpath), "%s/%s", conda_install_dir, ".condarc"); + snprintf(rcpath, sizeof(rcpath), "%s/%s", ctx->storage.conda_install_prefix, ".condarc"); setenv("CONDARC", rcpath, 1); setenv("MAMBARC", rcpath, 1); if (runtime_replace(&ctx->runtime.environ, __environ)) { @@ -122,8 +118,13 @@ void delivery_conda_enable(struct Delivery *ctx, char *conda_install_dir) { exit(1); } + if (conda_activate(ctx->storage.conda_install_prefix, "base")) { + SYSERROR("conda activation failed"); + exit(1); + } + char pinned[PATH_MAX]; - snprintf(pinned, sizeof(pinned), "%s/conda-meta/pinned", conda_install_dir); + snprintf(pinned, sizeof(pinned), "%s/conda-meta/pinned", ctx->storage.conda_install_prefix); touch(pinned); if (errno == ENOENT) { errno = 0; diff --git a/src/lib/delivery/include/delivery.h b/src/lib/delivery/include/delivery.h index 60255fe..7d846ab 100644 --- a/src/lib/delivery/include/delivery.h +++ b/src/lib/delivery/include/delivery.h @@ -356,9 +356,8 @@ void delivery_defer_packages(struct Delivery *ctx, int type); /** * Configure and activate a Conda installation based on Delivery context * @param ctx pointer to Delivery context - * @param conda_install_dir path to Conda installation */ -void delivery_conda_enable(struct Delivery *ctx, char *conda_install_dir); +void delivery_conda_enable(struct Delivery *ctx); /** * Install Conda -- cgit