Created
July 13, 2012 08:01
-
-
Save playpauseandstop/3103501 to your computer and use it in GitHub Desktop.
Playing with cloned virtual environments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Checking env_base virtual environment... | |
ordereddict exists | |
minimock exists | |
0.9 | |
Checking env_child virtual environment... | |
ordereddict exists | |
minimock exists | |
0.8 | |
Checking env_base virtual environment... | |
ordereddict exists | |
minimock exists | |
0.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# set -x | |
ROOT_DIR=`echo ~/Deploy/virtualenv-dawg` | |
function check_library { | |
echo "try: | |
import $1 | |
except ImportError: | |
print('$1 does not exist') | |
else: | |
print('$1 exists') | |
" > $ROOT_DIR/check_library.py | |
python $ROOT_DIR/check_library.py | |
rm $ROOT_DIR/check_library.py | |
} | |
function check_virtualenv { | |
echo "Checking $1 virtual environment..." | |
check_library ordereddict | |
check_library minimock | |
python -c 'import flask; print(flask.__version__)' | |
echo | |
} | |
VENV_BASE=env_base | |
VERSION_BASE=0.9 | |
VENV_CHILD=env_child | |
VERSION_CHILD=0.8 | |
if [ ! -d "$ROOT_DIR" ]; then | |
mkdir "$ROOT_DIR" | |
fi | |
if [ ! -d "$ROOT_DIR/cache" ]; then | |
mkdir "$ROOT_DIR/cache" | |
fi | |
cd $ROOT_DIR | |
rm -rf $VENV_BASE | |
rm -rf $VENV_CHILD | |
sudo pip install -q --download-cache=$ROOT_DIR/cache ordereddict virtualenv-clone | |
virtualenv -q --distribute --system-site-packages $VENV_BASE | |
. $VENV_BASE/bin/activate | |
pip install -q --download-cache=$ROOT_DIR/cache MiniMock | |
pip install -q --download-cache=$ROOT_DIR/cache Flask==$VERSION_BASE | |
check_virtualenv $VENV_BASE | |
deactivate | |
virtualenv-clone $VENV_BASE $VENV_CHILD | |
. $VENV_CHILD/bin/activate | |
pip install -q --download-cache=$ROOT_DIR/cache Flask==$VERSION_CHILD | |
check_virtualenv $VENV_CHILD | |
deactivate | |
. $VENV_BASE/bin/activate | |
check_virtualenv $VENV_BASE | |
deactivate | |
sudo pip uninstall -q ordereddict virtualenv-clone |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment