/
postBuild
59 lines (48 loc) · 1.46 KB
/
postBuild
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
#!/bin/bash
# https://github.com/gopherdata/mybinder-go/blob/master/LICENSE.md
set -ex
GOVERS=1.14
GONUMVERS=v0.7.0
GOPHERNOTESVERS=v0.7.1
mkdir -p \
$HOME/.local/go/$GOVERS \
$HOME/go
echo "::: install Go ${GOVERS}..."
curl -O -L https://golang.org/dl/go${GOVERS}.linux-amd64.tar.gz
tar -C $HOME/.local/go/$GOVERS -zxf go${GOVERS}.linux-amd64.tar.gz
rm go${GOVERS}.linux-amd64.tar.gz
export GO111MODULE=on
export GOROOT=$HOME/.local/go/$GOVERS/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
## install needed packages
echo "::: installing gophernotes, gonum and graphprac..."
go get golang.org/x/tools/cmd/goimports
go get github.com/gopherdata/gophernotes@${GOPHERNOTESVERS}
go get gonum.org/v1/gonum@${GONUMVERS}
go get gonum.org/v1/gonum/...
go get github.com/kortschak/graphprac
echo "::: installing gophernotes, gonum and graphprac... [done]"
## install the Go kernel
mkdir -p binder/gophernotes
cp $(go env GOPATH)/pkg/mod/github.com/gopherdata/gophernotes@${GOPHERNOTESVERS}/kernel/*.png binder/gophernotes
cat >binder/gophernotes/kernel.json <<EOF
{
"argv": [
"$GOPATH/bin/gophernotes",
"{connection_file}"
],
"display_name": "Go",
"language": "go",
"name": "go",
"env": {
"GOPATH": "$GOPATH",
"GOROOT": "$GOROOT",
"PATH": "$GOPATH/bin:$GOROOT/bin:$PATH"
}
}
EOF
jupyter kernelspec install binder/gophernotes --user
rm -rf binder
echo "::: kernel list"
jupyter kernelspec list