aboutsummaryrefslogtreecommitdiff
path: root/src/conda.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2023-12-10 00:39:41 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2023-12-10 00:39:41 -0500
commit7ae40adaf44602310de7dc87291d42041944fce4 (patch)
treefe5961f9780b020e6364aed36ad17d9d6f53ee52 /src/conda.c
parente46df1806ae35798ac2b72a8f3b24525abfb9f50 (diff)
downloadstasis-7ae40adaf44602310de7dc87291d42041944fce4.tar.gz
Add function conda_check_required()
* First pass. Needs work.
Diffstat (limited to 'src/conda.c')
-rw-r--r--src/conda.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/conda.c b/src/conda.c
index 24a4862..ef0e435 100644
--- a/src/conda.c
+++ b/src/conda.c
@@ -157,6 +157,43 @@ int conda_activate(const char *root, const char *env_name) {
return 0;
}
+int conda_check_required() {
+ int status = 0;
+ char *tools[] = {
+ "boa",
+ "conda-build",
+ "conda-verify",
+ NULL
+ };
+ struct StrList *result = NULL;
+ // TODO: Generate the command based on tools array
+ char *cmd_out = shell_output("conda list '^boa|^conda-build|^conda-verify' | cut -d ' ' -f 1", &status);
+ if (cmd_out) {
+ size_t found = 0;
+ result = strlist_init();
+ strlist_append_tokenize(result, cmd_out, "\n");
+ for (size_t i = 0; i < strlist_count(result); i++) {
+ char *item = strlist_item(result, i);
+ if (isempty(item) || startswith(item, "#")) {
+ continue;
+ }
+
+ for (size_t x = 0; tools[x] != NULL; x++) {
+ if (!strcmp(item, tools[x])) {
+ found++;
+ }
+ }
+ }
+ if (found < (sizeof(tools) / sizeof(*tools)) - 1) {
+ return 1;
+ }
+ } else {
+ msg(OMC_MSG_ERROR | OMC_MSG_L2, "The base package requirement check could not be performed\n");
+ return 2;
+ }
+ return 0;
+}
+
void conda_setup_headless() {
if (globals.verbose) {
conda_exec("config --system --set quiet false");