blob: d35999278545adaf13c7ebee3b3afbe747cbe975 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
package edu.stsci
import edu.stsci.OSInfo
class CondaInstaller implements Serializable {
OSInfo os
private String ident
String prefix
String dist_version
String installer
String url
def dist = [:]
CondaInstaller(prefix, dist="miniconda", variant="3", version="latest") {
def distributions = [
miniconda: [name: 'Miniconda',
variant: variant,
baseurl: 'https://repo.continuum.io/miniconda'],
anaconda: [name: 'Anaconda',
variant: variant,
baseurl: 'https://repo.continuum.io/archive']
]
this.ident = '[CONDA INSTALLER]'
this.os = new OSInfo()
this.dist = distributions."${dist}"
this.dist_version = version
this.prefix = prefix
this.installer = "${this.dist.name}${this.dist.variant}-" +
"${this.dist_version}-${this.os.name}-${this.os.arch}.sh"
this.url = "${this.dist.baseurl}/" + this.installer
}
void download() {
println("${this.ident} Downloading $url")
def cmd = "curl -qL ${this.url}"
def proc = cmd.execute()
def proc.inputStream.eachLine { println(it) }
// Whatever Jenkins...
/*
File fp = new File(this.installer)
def body = fp.newOutputStream()
body << new URL(this.url).openStream()
body.close()
println("${this.ident} Received ${fp.length()} bytes")
*/
return proc.exitValue()
}
int install() {
if (new File(this.prefix).exists()) {
println("${this.ident} ${this.prefix} exists.")
return 0xFF
}
//if (!new File(this.installer).exists()) {
this.download()
//}
def cmd = "bash ${this.installer} -b -p ${this.prefix}"
def proc = cmd.execute()
def stdout = new StringBuffer()
proc.inputStream.eachLine { println(it) }
//proc.waitForProcessOutput(stdout, System.err)
//print(stdout.toString())
return proc.exitValue()
}
private void detect() {
}
}
|