diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-05-26 09:35:21 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-05-26 09:35:21 +1200 |
commit | f7e77d543bcca84f75e09440841aacb582881da2 (patch) | |
tree | 418093e4df338ba5fee96cd8c75bda00b1f830b9 /dev.sh | |
parent | bcfce32bfaa06fbedaa754828fd7a1590ac3ca61 (diff) | |
download | mitmproxy-f7e77d543bcca84f75e09440841aacb582881da2.tar.gz mitmproxy-f7e77d543bcca84f75e09440841aacb582881da2.tar.bz2 mitmproxy-f7e77d543bcca84f75e09440841aacb582881da2.zip |
Refactor dev.sh
- Parameterise the Python version. All of these now work:
./dev.sh # Use default Python version
./dev.sh 2.7 # Explicitly use 2.7 in venv2.7
./dev.sh 3.5 # Explicitly use 3.5 in venv3.5
This should also work for Travis, which has a weird setup where Pytho3 can be
3.4.
Diffstat (limited to 'dev.sh')
-rwxr-xr-x | dev.sh | 29 |
1 files changed, 8 insertions, 21 deletions
@@ -1,29 +1,16 @@ #!/bin/sh set -e -VENV="./venv" -VENV3="${VENV}3" +PYVERSION=$1 +VENV="venv$1" -python -m virtualenv $VENV --always-copy -. $VENV/bin/activate -pip install -q -U pip setuptools -pip install -q -r requirements.txt +echo "Creating dev environment in $VENV using Python $PYVERSION" + +python$PYVERSION -m virtualenv "$VENV" --always-copy +. "$VENV/bin/activate" +pip$PYVERSION install -q -U pip setuptools +pip$PYVERSION install -q -r requirements.txt echo "" echo "* Virtualenv created in $VENV and all dependencies installed." echo "* You can now activate the $(python --version) virtualenv with this command: \`. $VENV/bin/activate\`" - -if $(python --version 2>&1 | grep -q "Python 2.") && command -v python3 >/dev/null 2>&1; then - echo "" - echo "" - - python3 -m virtualenv "$VENV3" --always-copy - . "$VENV3/bin/activate" - pip install -q -U pip setuptools - pip install -q -r requirements.txt - - echo "" - echo "* Virtualenv created in $VENV3 and all dependencies installed." - echo "* You can now activate the $(python --version) virtualenv with this command: \`. $VENV3/bin/activate\`" -fi - |