aboutsummaryrefslogtreecommitdiff
path: root/source/conda.d
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2019-05-21 14:47:45 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2019-05-21 14:47:45 -0400
commitfaa81e94ae2930a794e1ab1bab320b33e206abeb (patch)
tree1aea73fd256f2871f44c19253d25cb5e2ea4517f /source/conda.d
parentfe73a9d176f502feb454fde8c328d5ed761f50ff (diff)
downloaddm-faa81e94ae2930a794e1ab1bab320b33e206abeb.tar.gz
Can perform merge and dump
Diffstat (limited to 'source/conda.d')
-rw-r--r--source/conda.d40
1 files changed, 30 insertions, 10 deletions
diff --git a/source/conda.d b/source/conda.d
index 6fb7bd1..6dc66e6 100644
--- a/source/conda.d
+++ b/source/conda.d
@@ -147,7 +147,7 @@ class Conda {
bool installer() {
if (this.in_env() || this.install_prefix.exists) {
- writefln("Conda is already installed: %s", this.install_prefix);
+ writefln("Miniconda is already installed: %s", this.install_prefix);
return true;
} else if (this.install_prefix.empty) {
this.install_prefix = absolutePath("./miniconda");
@@ -156,22 +156,19 @@ class Conda {
}
if (this.have_installer()) {
- writeln("Installer already exists");
+ writeln("Miniconda installation script already exists");
} else {
download(this.url_installer, this.installer_file());
}
- auto installer = executeShell(
+ auto installer = this.sh(
"bash "
~ this.installer_file()
~ " -b"
~ " -p "
- ~ this.install_prefix,
- env=this.env);
+ ~ this.install_prefix);
- writeln(installer.output);
-
- if (installer.status != 0) {
+ if (installer != 0) {
return false;
}
@@ -227,8 +224,8 @@ class Conda {
return proc;
}
- auto sh_block(string command) {
- auto proc = executeShell(command, env=this.env);
+ auto run_block(string command) {
+ auto proc = this.sh_block("conda " ~ command);
return proc;
}
@@ -238,6 +235,11 @@ class Conda {
return wait(proc);
}
+ auto sh_block(string command) {
+ auto proc = executeShell(command, env=this.env);
+ return proc;
+ }
+
string multiarg(string flag, string[] arr) {
return flag ~ " " ~ arr.join(" " ~ flag ~ " ");
}
@@ -257,4 +259,22 @@ class Conda {
}
return result;
}
+
+ string dump_env_yaml(string filename=null) {
+ string args;
+ if (filename !is null) {
+ args = "--file " ~ filename;
+ }
+ auto proc = this.run_block("env export " ~ args);
+ return proc.output;
+ }
+
+ string dump_env_explicit(string filename=null) {
+ auto proc = this.run_block("list --explicit");
+ if (filename !is null) {
+ auto file = File(filename, "w+");
+ file.write(proc.output);
+ }
+ return proc.output;
+ }
}