68 lines
1.7 KiB
Bash
Executable File
68 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Description:
|
|
# Check to see if dependencies are installed.
|
|
# If not, warn the user and tell them how to
|
|
# install these dependencies.
|
|
#
|
|
# Usage:
|
|
# check-deps <dep> ...
|
|
#
|
|
# Options:
|
|
# One or more dependencies. Must use name of binary.
|
|
|
|
for dep in "$@"; do
|
|
if ! which $dep &> /dev/null; then
|
|
# Map binary name to package name
|
|
case $dep in
|
|
sphinx-apidoc|sphinx-build)
|
|
spack_package=py-sphinx
|
|
pip_package=sphinx
|
|
;;
|
|
coverage)
|
|
spack_package=py-coverage
|
|
pip_package=coverage
|
|
;;
|
|
flake8)
|
|
spack_package=py-flake8
|
|
pip_package=flake8
|
|
;;
|
|
git)
|
|
spack_package=git
|
|
;;
|
|
hg)
|
|
spack_package=py-mercurial
|
|
pip_package=mercurial
|
|
;;
|
|
svn)
|
|
spack_package=subversion
|
|
;;
|
|
*)
|
|
spack_package=$dep
|
|
pip_package=$dep
|
|
;;
|
|
esac
|
|
|
|
echo "ERROR: $dep is required to run this script."
|
|
echo
|
|
|
|
if [[ $spack_package ]]; then
|
|
echo "To install with Spack, run:"
|
|
echo " $ spack install $spack_package"
|
|
fi
|
|
|
|
if [[ $pip_package ]]; then
|
|
echo "To install with pip, run:"
|
|
echo " $ pip install $pip_package"
|
|
fi
|
|
|
|
if [[ $spack_package || $pip_package ]]; then
|
|
echo "Then add the bin directory to your PATH."
|
|
fi
|
|
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
echo "Dependencies found."
|