aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-06-24 10:57:01 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-06-24 10:57:01 -0400
commit1125dad3b50dbc0fd6540760e0db4b24dd9051e2 (patch)
treed9016c3fce01b5e0563f5609e14adff2894679b5
parent3b8e8078408feb49cd41272935f3df2e35faa092 (diff)
downloadstasis-1125dad3b50dbc0fd6540760e0db4b24dd9051e2.tar.gz
Implements conda reactivation template string
* {{ workaround.conda_reactivate }} * This is useful to call after installing any conda packages within a test.script
-rw-r--r--include/core.h1
-rw-r--r--src/delivery.c7
-rw-r--r--src/globals.c1
-rw-r--r--src/stasis_main.c1
4 files changed, 10 insertions, 0 deletions
diff --git a/include/core.h b/include/core.h
index 1a7ddea..ac9ae2f 100644
--- a/include/core.h
+++ b/include/core.h
@@ -72,6 +72,7 @@ struct STASIS_GLOBAL {
char *sysconfdir; //!< Path where STASIS reads its configuration files (mission directory, etc)
struct {
char *tox_posargs;
+ char *conda_reactivate;
} workaround;
struct Jfrog {
char *jfrog_artifactory_base_url;
diff --git a/src/delivery.c b/src/delivery.c
index 5c507bf..2064bd3 100644
--- a/src/delivery.c
+++ b/src/delivery.c
@@ -1687,6 +1687,13 @@ void delivery_tests_run(struct Delivery *ctx) {
struct Process proc;
memset(&proc, 0, sizeof(proc));
+ if (!globals.workaround.conda_reactivate) {
+ globals.workaround.conda_reactivate = calloc(PATH_MAX, sizeof(*globals.workaround.conda_reactivate));
+ } else {
+ memset(globals.workaround.conda_reactivate, 0, PATH_MAX);
+ }
+ snprintf(globals.workaround.conda_reactivate, PATH_MAX - 1, "\nset +x\neval `conda shell.posix reactivate`\nset -x\n");
+
if (!ctx->tests[0].name) {
msg(STASIS_MSG_WARN | STASIS_MSG_L2, "no tests are defined!\n");
} else {
diff --git a/src/globals.c b/src/globals.c
index 7ed7c3c..297598f 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -54,4 +54,5 @@ void globals_free() {
guard_free(globals.jfrog.jfrog_artifactory_product);
guard_free(globals.jfrog.remote_filename);
guard_free(globals.workaround.tox_posargs);
+ guard_free(globals.workaround.conda_reactivate);
}
diff --git a/src/stasis_main.c b/src/stasis_main.c
index 8f4e22e..c550982 100644
--- a/src/stasis_main.c
+++ b/src/stasis_main.c
@@ -258,6 +258,7 @@ int main(int argc, char *argv[]) {
tpl_register("deploy.jfrog.url", &globals.jfrog.url);
tpl_register("deploy.docker.registry", &ctx.deploy.docker.registry);
tpl_register("workaround.tox_posargs", &globals.workaround.tox_posargs);
+ tpl_register("workaround.conda_reactivate", &globals.workaround.conda_reactivate);
// Set up PREFIX/etc directory information
// The user may manipulate the base directory path with STASIS_SYSCONFDIR