Skip to content

Instantly share code, notes, and snippets.

@SamuelMarks
Created January 23, 2018 07:15
Show Gist options
  • Save SamuelMarks/6555ca996ce11787515af25f1d2d2a83 to your computer and use it in GitHub Desktop.
Save SamuelMarks/6555ca996ce11787515af25f1d2d2a83 to your computer and use it in GitHub Desktop.
[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