mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 23:51:07 -05:00
fc6c5b34d9
* Build static python depenencies * Address linting * Fix copy path * cleaner * Stage virtual environments * Update Dockerfile to support virtual environments * Remove old python builds * Remove unnecessary RUN step * Fix merge conflicts * Remove test checking for PIP packages We use virtual environments and no longer install the packages via pip directly in the image. It should be enough that the version tests check for the existence already and that the version comes back correctly. * Remove binary installation of black * cleaner * Remove pip * pretty Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
43 lines
1.4 KiB
Bash
Executable file
43 lines
1.4 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 #
|
|
#########################################################
|
|
while read -r LINE; do
|
|
# split the package name from its version
|
|
PACKAGE_NAME=$(cut -d'=' -f1 <<<"${LINE}")
|
|
if [[ "${PACKAGE_NAME}" == *"["* ]]; then
|
|
PACKAGE_NAME=$(cut -d'[' -f1 <<<"${PACKAGE_NAME}")
|
|
fi
|
|
echo "-------------------------------------------"
|
|
mkdir -p "/venvs/${PACKAGE_NAME}"
|
|
cp "${PACKAGE_NAME}/requirements.txt" "/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 <packages.txt
|