Created
February 1, 2017 15:40
-
-
Save monokal/6fc2790b9e6703feeec9c2cff473b659 to your computer and use it in GitHub Desktop.
FPM before-install script to install PyPI dependancies.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
modules=( \ | |
daemonize \ | |
requests \ | |
) | |
package_managers=( \ | |
pip \ | |
easy_install \ | |
) | |
echo "Installing PyPI module dependencies..." | |
for p in "${package_managers[@]}"; do | |
echo "Checking system for \"${p}\"..." | |
if [ -x "$(command -v ${p})" ]; then | |
echo "Found \"${p}\"." >&2 | |
p_args='' | |
if [ "${p}" == 'pip' ]; then | |
p_args='install' | |
fi | |
for m in "${modules[@]}"; do | |
echo "Installing ${m} module..." | |
${p} ${p_args} ${m} | |
if [ $? -eq 0 ]; then | |
echo 'OK.' | |
else | |
echo "Failed to install \"${m}\" module via ${p}." | |
exit 1 | |
fi | |
done | |
echo "Completed before-install tasks." | |
exit 0 | |
else | |
echo "\"${p}\" is not installed." | |
fi | |
done | |
echo "Failed to find a PyPI package manager." | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment