Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[offscale] Install all dependencies via pip
#!/usr/bin/env bash
if [ ! -z DIR ]; then DIR=(off*/); fi
VENV="${VENV:-.offenv}"
REQUIREMENTS="${REQUIREMENTS:-'requirements.txt'}";
if [ ! -d "$VENV/bin" ]; then
echo Cannot find "$VENV/bin"
exit 2;
fi
source "$VENV/bin/activate"
for f in "${DIR[@]}"; do
if [ -f "$f/setup.py" ]; then
builtin cd "$f";
pip uninstall -y "${PWD##*/}";
if [ -f "$REQUIREMENTS" ]; then
pip install -r "$REQUIREMENTS"
fi
pip install .;
builtin cd ..;
fi;
done
@echo off
:: Note: this hasn't been tested, so comments/testing are very welcome!
if "%VENV%"=="" ("%VENV%\Scripts\activate")
if "%REQUIREMENTS%"=="" (set REQUIREMENTS="requirements.txt")
:: TODO: Handle failure on no existent %REQUIREMENTS% and on no setup.py
for /d %%i in (*.*) do cd %%i & pip install & pip install -r %REQUIREMENTS% & cd..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.