diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2023-10-31 15:54:13 -0400 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2023-10-31 15:54:13 -0400 | 
| commit | 105fdff98d10ba206c9243c1c1e826e659ea51a0 (patch) | |
| tree | b532ea9e07e7b8af0cd15b37fda770cbdd0b2aaf | |
| parent | c5a81d35b335962d3aa8e3d71b1082c4f9088d23 (diff) | |
| download | stasis-105fdff98d10ba206c9243c1c1e826e659ea51a0.tar.gz | |
Consolidate conda_setup_headless() from main.c
| -rw-r--r-- | include/conda.h | 1 | ||||
| -rw-r--r-- | src/conda.c | 16 | 
2 files changed, 16 insertions, 1 deletions
| diff --git a/include/conda.h b/include/conda.h index a642702..325ca48 100644 --- a/include/conda.h +++ b/include/conda.h @@ -15,6 +15,7 @@ int python_exec(const char *args);  int pip_exec(const char *args);  int conda_exec(const char *args);  int conda_activate(const char *root, const char *env_name); +void conda_setup_headless();  void conda_env_create_from_uri(char *name, char *uri);  void conda_env_create(char *name, char *python_version, char *packages);  void conda_env_remove(char *name); diff --git a/src/conda.c b/src/conda.c index 0d3e0da..f18d2d1 100644 --- a/src/conda.c +++ b/src/conda.c @@ -111,7 +111,6 @@ int conda_activate(const char *root, const char *env_name) {          perror(logfile);          return -1;      } -    static char buf[1024];      int i = 0;      while (!feof(fp)) {          char buf[BUFSIZ] = {0}; @@ -153,6 +152,21 @@ int conda_activate(const char *root, const char *env_name) {      return 0;  } +void conda_setup_headless() { +    // Configure conda for headless CI +    conda_exec("config --system --set auto_update_conda false"); +    conda_exec("config --system --set always_yes true"); +    conda_exec("config --system --set quiet true"); +    conda_exec("config --system --set rollback_enabled false"); +    conda_exec("config --system --set report_errors false"); + +    // make this configurable +    //if (conda_exec("update --all")) { +    //    fprintf(stderr, "conda update was unsuccessful\n"); +    //    exit(1); +    //} +} +  void conda_env_create_from_uri(char *name, char *uri) {      char env_command[PATH_MAX];      sprintf(env_command, "env create -n %s -f %s", name, uri); | 
