-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildMirge.sh
executable file
·117 lines (102 loc) · 3.83 KB
/
buildMirge.sh
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
# default branch for building mirgecom for this driver
mirge_branch="production"
# conda environment name
conda_env="mirgeDriver.shock1d"
usage()
{
echo "Usage: $0 [options]"
echo " --use-ssh Use ssh-keys to clone emirge/mirgecom"
echo " --restore-build Build with previously stored version information for mirgecom and associated packages"
echo " --help Print this help text."
}
opt_git_ssh=0
opt_restore_build=0
while [[ $# -gt 0 ]];do
arg=$1
shift
case $arg in
--use-ssh)
opt_git_ssh=1
;;
--restore-build)
opt_restore_build=1
;;
--help)
usage
exit 0
;;
*)
echo "=== Error: unknown argument '$arg' ."
usage
exit 1
;;
esac
done
git_method=""
if [ $opt_git_ssh -eq 1 ]; then
git_method="--git-ssh"
fi
# get emirge
if [ -z "$(ls -A emirge)" ]; then
if [ $opt_git_ssh -eq 1 ]; then
echo "git clone [email protected]:illinois-ceesd/emirge.git emirge"
git clone [email protected]:illinois-ceesd/emirge.git emirge
else
echo "git clone https://github.com/illinois-ceesd/emirge.git emirge"
git clone https://github.com/illinois-ceesd/emirge.git emirge
fi
else
echo "emirge install already present. Remove to build anew"
fi
# install script for mirgecom,
if [ ${opt_restore_build} -eq 1 ]; then
# attempt to restore an existing build
echo "Building MIRGE-Com from existing known configuration"
if [ ${MIRGE_PLATFORM} ]; then
if [ -z "$(ls -A platforms/${MIRGE_PLATFORM})" ]; then
echo "Unknown platform ${MIRGE_PLATFORM}"
echo "Currently stored configurations are:"
ls platforms
else
echo "Using version information for ${MIRGE_PLATFORM}"
cd emirge
versionDir="platforms/${MIRGE_PLATFORM}"
if [ -z ${CONDA_PATH+x} ]; then
echo "CONDA_PATH unset, installing new conda with emirge"
echo "./install.sh --env-name=$conda_env $git_method --conda-env=${versionDir}/myenv.yml --pip-pkgs=${versionDir}/myreqs.txt"
./install.sh --env-name=$conda_env $git_method --conda-env=${versionDir}/myenv.yml --pip-pkgs=${versionDir}/myreqs.txt
else
echo "Using existing Conda installation, ${CONDA_PATH}"
echo "./install.sh --conda-prefix=$CONDA_PATH --env-name=$conda_env --conda-env=${versionDir}/myenv.yml --pip-pkgs=${versionDir}/myreqs.txt"
./install.sh --conda-prefix=$CONDA_PATH --env-name=$conda_env --conda-env=${versionDir}/myenv.yml --pip-pkgs=${versionDir}/myreqs.txt
fi
fi
else
echo "Unknown platform. Set the environment variable MIRGE_PLATFORM for automated build and storage"
echo "For example in bash: export MIRGE_PLATFORM=\"mac-m1\""
echo "Automated build failed and will now exit."
fi
else
# build with the current development head
echo "Building MIRGE-Com from the current development head"
echo "***WARNING*** may not be compatible with this driver ***WARNING"
echo "Consider using --restore-build and setting MIRGE_PLATFORM as appropriate for this platform"
cd emirge
if [ -z ${CONDA_PATH+x} ]; then
echo "CONDA_PATH unset, installing new conda with emirge"
echo "./install.sh --env-name=${conda_env} ${git_method} --branch=${mirge_branch}"
./install.sh --env-name=${conda_env} ${git_method} --branch=${mirge_branch}
else
echo "Using existing Conda installation, ${CONDA_PATH}"
echo "./install.sh --conda-prefix=$CONDA_PATH --env-name=${conda_env} ${git_method} --branch=${mirge_branch}"
./install.sh --conda-prefix=$CONDA_PATH --env-name=${conda_env} ${git_method} --branch=${mirge_branch}
fi
fi
# add a few packages that are required for our development process
source config/activate_env.sh
#conda activate ${conda_env}
python -m pip install flake8 flake8-quotes pylint
# install the git hooks script to get linting on commits
cd ..
cp githooks/pre-commit .git/hooks/pre-commit