-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathsetup
More file actions
executable file
·328 lines (277 loc) · 8.16 KB
/
setup
File metadata and controls
executable file
·328 lines (277 loc) · 8.16 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#!/bin/sh
# This script is written in POSIX-compliant shell, and should run with any shell
# supporting this, including dash (/bin/sh on Ubuntu), bash (/bin/sh on many other
# systems) and bash 3.2 (/bin/sh on macOS). Zsh should also work in POSIX mode, so if
# macOS ever changes its /bin/sh then we should still be good.
# This is written in an old-fashioned style with procedures and global variables,
# because that's all we can do in a shell. Please don't write shell scripts this long if
# you can avoid it, and please don't use global variables like this in any other
# language.
# When installing the framework into a conda environment, we install these conda
# versions of its dependencies to minimise the number of pip-installed packages.
# These must be single-quoted as shown, or the code below will get confused.
#
FRAMEWORK_CONDA_DEPS="'docutils>=0.6' 'mpi4py>=1.1.0' 'numpy>=1.2.2' 'h5py>=1.1.0'"
# Disabled tests
#
# Some of the tests are currently broken, and we need to figure out what to do with them
# and/or who needs to fix them how. Meanwhile, we want to have a set of passing tests
# for our new CI, because we don't want to normalise failure. So we disable the broken
# tests for now, but print a note whenever the tests are run. See issue #1103.
#
BAD_EXT_TESTS="test_jobserver TestLimepy TestRotatingBridge::test1"
BAD_EXT_TESTS="${BAD_EXT_TESTS} TestHeatingWind::test_supernova"
BAD_EXT_TESTS="${BAD_EXT_TESTS} TestHeatingWind::test_supernova_manual"
BAD_EXT_TESTS="${BAD_EXT_TESTS} TestsForIssue123"
# Extra pytest options for debugging
PYTEST_OPTS=''
# PYTEST_OPTS='-s -vvv --log-cli-level=debug'
. support/setup/util.sh
. support/setup/log.sh
. support/setup/format.sh
. support/setup/help.sh
. support/setup/environment.sh
. support/setup/installing.sh
. support/setup/testing.sh
# Show the current configuration
#
# This uses the following variables:
#
# FEATURES - from support/configuration.sh
#
configure() {
en_pack_text="$(printf '%b' "${ENABLED_PACKAGES_TEXT}" | pr -3 -t -w 90)"
printf '\n'
printf '%b\n' "${COLOR_CYAN}*** Configuration complete ***${COLOR_END}"
printf 'Detected features:%s\n' "${FEATURES}"
printf '\n'
printf '%b\n' "${COLOR_GREEN}** Enabled packages **${COLOR_END}"
printf '\n%b\n' "Packages marked i) are currently installed."
printf '\n%b' "${en_pack_text}"
printf '\n\n'
printf '%b\n' "${COLOR_RED}** Disabled packages **${COLOR_END}"
printf '\n%b' "${DISABLED_PACKAGES_TEXT}"
printf '%b' "${BROKEN_PACKAGES_TEXT}"
printf '\n'
printf '%s\n' "For broken packages, you can find the listed issue at https://github.com/amusecode/amuse/issues"
printf '\n'
printf '%b\n\n' "${COLOR_CYAN}*** Next steps ***${COLOR_END}"
check_shell_environment
can_install="yes"
if [ "a${ENV_TYPE}" = "a" ] ; then
print_environment_step
can_install="no"
elif [ "a${HAVE_PIP}" = "a" ] || [ "a${HAVE_WHEEL}" = "a" ] ; then
print_pip_wheel_step
can_install="no"
elif [ "a${DISABLED_PACKAGES}" != "a" ] ; then
print_enable_packages_step
fi
if [ "a${ENABLED_PACKAGES}" = "a" ] ; then
can_install="no"
fi
if [ "${can_install}" = "yes" ] ; then
print_install_amuse_step
fi
}
# Install command
#
# This checks what we're supposed to install and dispatches accordingly.
#
install() {
targets="$*"
for target in ${targets} ; do
check_install "${target}"
case ${target} in
all )
install_all
;;
amuse-framework | framework )
target="$(normalise_package_name ${target})"
install_framework
;;
sapporo_light )
install_sapporo_light
;;
* )
target="$(normalise_package_name ${target})"
install_package install "${target}"
;;
esac
done
}
# Develop command
#
# Does a develop install of something.
#
# This checks what we're supposed to develop-install and dispatches accordingly.
#
develop() {
targets="$*"
for target in ${targets} ; do
check_install "${target}"
case ${target} in
amuse-framework | framework )
develop_framework
;;
* )
target="$(normalise_package_name ${target})"
install_package develop "${target}"
;;
esac
done
}
# Package command
#
# Does a package building install of something.
#
# This checks what we're supposed to package-install and dispatches accordingly.
#
package() {
target="$1"
case ${target} in
amuse-framework | framework )
package_framework
;;
* )
forward_to_package package "${target}"
;;
esac
}
# Test command
#
# Runs tests for a package or for the framework. The tests are run against the installed
# package, so that they also test the installation procedure.
#
run_test() {
targets="$*"
ensure_pytest
for target in ${targets} ; do
case ${target} in
all )
test_all
;;
amuse-framework | framework )
check_package_installed_for_test amuse-framework
test_framework
;;
amuse-ext | ext )
check_package_installed_for_test amuse-framework
test_amuse_ext
;;
* )
target="$(normalise_package_name ${target})"
check_package_installed_for_test "${target}"
forward_to_package "test" "${target}"
;;
esac
done
}
# Uninstall command
#
# This checks what we're supposed to uninstall and dispatches accordingly.
#
uninstall() {
for target in $* ; do
check_uninstall "${target}"
case ${target} in
amuse-framework | framework )
uninstall_framework
;;
sapporo_light )
uninstall_sapporo_light
;;
all )
uninstall_framework
uninstall_sapporo_light
;;
* )
target="$(normalise_package_name ${target})"
uninstall_package "${target}"
;;
esac
done
}
# Clean command
#
# Calls make clean on the entire codebase.
#
clean() {
${GMAKE} -C support clean
${GMAKE} -C lib clean
${GMAKE} -C lib clean-sapporo_light
for code in src/amuse_* ; do ${GMAKE} -C "${code}" clean ; done
${GMAKE} -C src/tests clean
}
# Distclean command
#
# Calls make distclean on the entire codebase.
#
distclean() {
${GMAKE} -C support distclean
${GMAKE} -C lib distclean
${GMAKE} -C lib distclean-sapporo_light
for code in src/amuse_* ; do ${GMAKE} -C "${code}" distclean ; done
${GMAKE} -C src/tests distclean
}
### Main script ###
CMD="$1"
if [ "a$#" != "a0" ] ; then
shift
TARGETS="$*"
else
TARGETS=''
fi
case ${CMD} in
help )
print_help
exit 0
;;
"" )
CMD="configure"
;;
esac
printf '%s\n' 'Checking for dependencies, one moment please...'
if ! (cd support && ./configure >config.out 2>&1) ; then
printf '%s\n\n' 'An error occurred running configure. This should not happen.'
printf '%s\n' 'Please create an issue at http://github.com/amusecode/amuse/issues'
printf '%s\n' 'and attach the support/config.log file to it, or ask for help on'
printf '%s\n' 'the AMUSE Slack.'
exit 1
fi
. support/configuration.sh
analyse_environment
case ${CMD} in
configure | "" )
configure
;;
install )
# Building MESA tends to crash with "Too many open files" without this
ulimit -n 10240
install ${TARGETS}
;;
test )
run_test ${TARGETS}
;;
develop )
develop ${TARGETS}
;;
package )
package ${TARGETS}
;;
uninstall )
uninstall ${TARGETS}
;;
clean )
clean
exit 0
;;
distclean )
distclean
exit 0
;;
* )
print_invalid_command "${CMD}"
exit 1
;;
esac