2019-11-19 21:51:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
failure_exit() {
|
|
|
|
echo >&2 "Could not find ${1}. Please install that before continuing."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2020-12-07 23:19:16 +00:00
|
|
|
check_python_version() {
|
2022-03-08 05:51:20 +00:00
|
|
|
if ! command -v python"$PYMAJOR"."$PYMINOR" &> /dev/null; then
|
2022-03-04 03:13:58 +00:00
|
|
|
echo >&2 "Must compile with python $PYMAJOR.$PYMINOR."
|
2020-12-07 23:19:16 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
2019-11-19 21:51:45 +00:00
|
|
|
check_python_headers() {
|
|
|
|
local python_headers_present
|
2022-03-08 05:51:20 +00:00
|
|
|
python_headers_present=$(pkg-config --libs python-"$PYMAJOR"."$PYMINOR")
|
2019-11-19 21:51:45 +00:00
|
|
|
|
|
|
|
if [ ! "${python_headers_present}" ]; then
|
2022-03-04 03:13:58 +00:00
|
|
|
failure_exit "Python $PYMAJOR.$PYMINOR headers"
|
2019-11-19 21:51:45 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
check_binary_present() {
|
|
|
|
local binary_exists
|
|
|
|
binary_exists="$(command -v "${1}")"
|
|
|
|
if [ ! "${binary_exists}" ]; then
|
|
|
|
failure_exit "${1}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-02 22:42:43 +00:00
|
|
|
check_pkgconfig() {
|
|
|
|
check_binary_present "pkg-config"
|
|
|
|
}
|
|
|
|
|
2021-06-04 07:36:46 +00:00
|
|
|
check_md5sum() {
|
|
|
|
check_binary_present "md5sum"
|
|
|
|
}
|
|
|
|
|
2019-11-19 21:51:45 +00:00
|
|
|
check_fortran_dependencies() {
|
|
|
|
check_binary_present "gfortran"
|
|
|
|
check_binary_present "f2c"
|
|
|
|
}
|
|
|
|
|
|
|
|
check_pyyaml() {
|
|
|
|
local pyyaml_import_check
|
2020-01-02 22:42:43 +00:00
|
|
|
pyyaml_import_check="$(python3 -c 'import yaml' 2>&1)"
|
2019-11-19 21:51:45 +00:00
|
|
|
if [ "${pyyaml_import_check}" ]; then
|
|
|
|
failure_exit "PyYAML"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-12-07 23:19:16 +00:00
|
|
|
check_python_version
|
2020-01-02 22:42:43 +00:00
|
|
|
check_pkgconfig
|
2020-07-07 14:21:33 +00:00
|
|
|
#check_python_headers
|
2019-11-19 21:51:45 +00:00
|
|
|
check_fortran_dependencies
|
|
|
|
check_pyyaml
|
2021-06-04 07:36:46 +00:00
|
|
|
check_md5sum
|