2022-01-10 16:23:22 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
################################################################################
|
|
|
|
########################### Install Python Dependancies ########################
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
#####################
|
|
|
|
# Set fail on error #
|
|
|
|
#####################
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
############################
|
|
|
|
# Create staging directory #
|
|
|
|
############################
|
|
|
|
mkdir -p /venvs
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# Install basic libs to run installers #
|
|
|
|
########################################
|
|
|
|
pip install virtualenv
|
|
|
|
|
|
|
|
#########################################################
|
|
|
|
# Itterate through requirments.txt to install bainaries #
|
|
|
|
#########################################################
|
2022-01-10 21:25:37 -05:00
|
|
|
for DEP_FILE in *.txt; do
|
2022-01-10 16:23:22 -05:00
|
|
|
# split the package name from its version
|
2022-01-10 21:25:37 -05:00
|
|
|
PACKAGE_NAME=${DEP_FILE%.txt}
|
2022-01-10 16:23:22 -05:00
|
|
|
echo "-------------------------------------------"
|
|
|
|
mkdir -p "/venvs/${PACKAGE_NAME}"
|
2022-01-10 21:25:37 -05:00
|
|
|
cp "${DEP_FILE}" "/venvs/${PACKAGE_NAME}/requirements.txt"
|
2022-01-10 16:23:22 -05:00
|
|
|
echo "Generating virtualenv for: [${PACKAGE_NAME}]"
|
|
|
|
pushd "/venvs/${PACKAGE_NAME}"
|
|
|
|
virtualenv .
|
|
|
|
# shellcheck disable=SC1091
|
|
|
|
source bin/activate
|
|
|
|
pip install -r requirements.txt
|
|
|
|
# deactivate the python virtualenv
|
|
|
|
deactivate
|
|
|
|
# pop the stack
|
|
|
|
popd
|
2022-01-10 21:25:37 -05:00
|
|
|
done
|