lint/dependencies/python/build-venvs.sh
Jameel Al-Aziz 7e1683407d Update Dependabot for python virtual envs
* Simplify virtualenv installation to use multiple requirements files in
  a single directory. This eliminates the packages.txt file and provides
  an easier path to adding new tools in the future. It also allows us to
  simplify the dependenabot configuration as all requirements files are
  in a single directory.
* Update dependabot.yml to point to the new Python dependencies folder.
2022-01-11 10:05:56 -05:00

40 lines
1.3 KiB
Bash
Executable file

#!/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 #
#########################################################
for DEP_FILE in *.txt; do
# split the package name from its version
PACKAGE_NAME=${DEP_FILE%.txt}
echo "-------------------------------------------"
mkdir -p "/venvs/${PACKAGE_NAME}"
cp "${DEP_FILE}" "/venvs/${PACKAGE_NAME}/requirements.txt"
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
done