summaryrefslogtreecommitdiff
path: root/src/org/stsci/Conda.groovy
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2018-01-24 21:27:41 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2018-01-24 21:28:15 -0500
commit7f9fe6def81ebe837a5551b06ff5c7e759598555 (patch)
tree8b852d29952c9880a18d3e39bca8f350f4e53bef /src/org/stsci/Conda.groovy
parent9c709674182112fdb693c6bcb53b48db2823e0d3 (diff)
downloadgroovy-sandbox-7f9fe6def81ebe837a5551b06ff5c7e759598555.tar.gz
Uses pair assignment instead of k,v; Add remove function
Signed-off-by: Joseph Hunkeler <jhunkeler@gmail.com>
Diffstat (limited to 'src/org/stsci/Conda.groovy')
-rw-r--r--src/org/stsci/Conda.groovy38
1 files changed, 11 insertions, 27 deletions
diff --git a/src/org/stsci/Conda.groovy b/src/org/stsci/Conda.groovy
index d0736e0..dc67052 100644
--- a/src/org/stsci/Conda.groovy
+++ b/src/org/stsci/Conda.groovy
@@ -61,7 +61,7 @@ class Conda implements Serializable {
if (pair[0].contains("_FUNC_") || !line.contains("=")) {
return
}
- records."$k" = v
+ records."${pair[0]}" = pair[1]
}
}
@@ -110,6 +110,7 @@ class Conda implements Serializable {
String cmd = "${prefix}/bin/conda ${task}"
cmd += ' ' + args.join(' ')
+
if (prompt_avoid) {
cmd += ' ' + silent_args.join(' ')
}
@@ -162,6 +163,15 @@ class Conda implements Serializable {
return proc.exitcode
}
+ int remove(String packages, boolean force=false) {
+ String args = ""
+ if (force) {
+ args = "--force"
+ }
+ def proc = this.command("remove", args, packages)
+ return proc.exitcode
+ }
+
int destroy(String name) {
String args = "-n \"${name}\""
def proc = this.command("env remove", args)
@@ -169,29 +179,3 @@ class Conda implements Serializable {
}
}
-/*
-static void main(String[] args) {
- final String PREFIX = "/tmp/miniconda3"
- final String NAME = "astroconda35"
- final String PKGS = "python=3.5 numpy=1.12 drizzlepac"
-
- cinst = new CondaInstaller(PREFIX)
- cinst.install()
-
- c = new Conda(PREFIX)
- assert c.prefix_exists == true
-
- c.override = true
- c.channels.add("astropy")
- c.channels.add("http://ssb.stsci.edu/astroconda")
- c.channels.add("conda-forge")
-
- if (c.provides(NAME)) {
- assert c.destroy(NAME) == 0
- }
- assert c.create(NAME, PKGS) == 0
- c.activate(NAME)
- assert c.environment_name == NAME
- assert c.provides(NAME) == true
-}
-*/