Skip to content

Instantly share code, notes, and snippets.

@monokal
Created February 1, 2017 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save monokal/6fc2790b9e6703feeec9c2cff473b659 to your computer and use it in GitHub Desktop.
Save monokal/6fc2790b9e6703feeec9c2cff473b659 to your computer and use it in GitHub Desktop.
FPM before-install script to install PyPI dependancies.
#!/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