-
Notifications
You must be signed in to change notification settings - Fork 2
/
activate
42 lines (33 loc) · 1.34 KB
/
activate
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
# script to prepare the environment to load packages from the creduce depot
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DEPOT="$DIR/depot"
export JULIA_PKG_DEVDIR=$DEPOT/dev # only for Pkg operations, not used by code loading
if [[ "$(pwd)" != "$DIR" ]]; then
# out-of-tree execution, by creduce
# use a layered depot so that we don't contaminate the global one
export JULIA_DEPOT_PATH="$(pwd)/depot:$DEPOT:"
# initialize the depot if it doesn't exist
if [[ -d "$DEPOT" && ! -d depot ]]; then
mkdir -p depot
# we need to copy the devdir (even though we'll overwrite sources from src.list,
# there may be non-sources we need) and the environment (to rewrite the Manifest)
for dir in dev environments; do
if [[ -d "$DEPOT/$dir" ]]; then
cp -arf "$DEPOT/$dir" depot/
fi
done
if [[ -d depot/environments ]]; then
# rewrite manifests to point dev'ed packages to our new depot
sed -i "s#path = \".*/depot/dev#path = \"$(pwd)/depot/dev#g" depot/environments/*/Manifest.toml
fi
fi
# copy-in the files created by creduce
i=1
while IFS= read -r path; do
mkdir -p $(dirname $path)
cp "$i.jl" "$path"
(( i++ ))
done < "$DIR/src.lst"
else
export JULIA_DEPOT_PATH="$DEPOT:"
fi