Skip to content

Instantly share code, notes, and snippets.

@ArcTanSusan
Created February 23, 2016 01:48
Show Gist options
  • Save ArcTanSusan/41807c689564cfe90bf7 to your computer and use it in GitHub Desktop.
Save ArcTanSusan/41807c689564cfe90bf7 to your computer and use it in GitHub Desktop.
# This is the same .env used in ALL the sub-projects within Orbital
# Each sub-project in Orbital repo shall have its own virtualenv
set -x
function make_new_virtualenv {
echo "No virtualenv for this sub-project exists, so let's make one."
# Make a new virtualenv
mkvirtualenv "${PWD##*/}"
# Install all dependencies listed in this sub-project
if [ -s "pip-requires" ]
then pip install -r pip-requires
elif [ -s "test-requires" ]
then pip install -r test-requires
elif [ -s "requirements.txt" ]
then pip install -r requirements.txt
elif [ -s "test-requirements.txt" ]
then pip install -r test-requirements.txt
elif [ -s "setup.py" ]
then
pip install .
pip install --upgrade "${PWD##*/}"[test]
else
echo "There are no dependencies to install in this newly created virtualenv"
fi
}
workon "${PWD##*/}"
if [ $? -eq 0 ]
then
echo "Activated existing virtualenv successfully."
exit 1
else
make_new_virtualenv
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment