always use 'venv' as virtualenv folder

This commit is contained in:
Maximilian Hils 2017-01-30 00:38:40 +01:00
parent f570c57006
commit 3fe2f9578a
3 changed files with 15 additions and 18 deletions

View File

@ -69,9 +69,9 @@ To get started hacking on mitmproxy, please follow the `advanced installation`_
./dev.sh # "powershell .\dev.ps1" on Windows ./dev.sh # "powershell .\dev.ps1" on Windows
The *dev* script will create a `virtualenv`_ environment in a directory called The *dev* script will create a `virtualenv`_ environment in a directory called "venv"
"venv3.5", and install all mandatory and optional dependencies into it. The and install all mandatory and optional dependencies into it. The primary
primary mitmproxy components - mitmproxy and pathod - are installed as mitmproxy components - mitmproxy and pathod - are installed as
"editable", so any changes to the source in the repository will be reflected "editable", so any changes to the source in the repository will be reflected
live in the virtualenv. live in the virtualenv.
@ -82,7 +82,7 @@ you can run them like any other command:
.. code-block:: text .. code-block:: text
. venv3.5/bin/activate # "venv\Scripts\activate" on Windows . venv/bin/activate # "venv\Scripts\activate" on Windows
mitmdump --version mitmdump --version
Testing Testing

View File

@ -1,20 +1,19 @@
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$VENV = ".\venv"
$pyver = python --version $pyver = python --version
if($pyver -notmatch "3\.[5-9]") { if($pyver -notmatch "3\.[5-9]") {
Write-Warning "Unexpected Python version, expected Python 3.5 or above: $pyver" Write-Warning "Unexpected Python version, expected Python 3.5 or above: $pyver"
} }
python -m venv $VENV --copies python -m venv .\venv --copies
& $VENV\Scripts\activate.ps1 & .\venv\Scripts\activate.ps1
python -m pip install --disable-pip-version-check -U pip python -m pip install --disable-pip-version-check -U pip
cmd /c "pip install -r requirements.txt 2>&1" cmd /c "pip install -r requirements.txt 2>&1"
echo @" echo @"
* Created virtualenv environment in $VENV. * Created virtualenv environment in .\venv.
* Installed all dependencies into the virtualenv. * Installed all dependencies into the virtualenv.
* Activated virtualenv environment. * Activated virtualenv environment.

18
dev.sh
View File

@ -2,16 +2,14 @@
set -e set -e
set -x set -x
PYVERSION=${1:-3.5} echo "Creating dev environment in ./venv..."
VENV="venv$PYVERSION"
echo "Creating dev environment in $VENV using Python $PYVERSION" python3 -m venv venv
. venv/bin/activate
python$PYVERSION -m venv "$VENV" pip3 install -U pip setuptools
. "$VENV/bin/activate" pip3 install -r requirements.txt
pip$PYVERSION install -U pip setuptools
pip$PYVERSION install -r requirements.txt
echo "" echo ""
echo "* Virtualenv created in $VENV and all dependencies installed." echo " * Created virtualenv environment in ./venv."
echo "* You can now activate the $(python --version) virtualenv with this command: \`. $VENV/bin/activate\`" echo " * Installed all dependencies into the virtualenv."
echo " * You can now activate the $(python3 --version) virtualenv with this command: \`. venv/bin/activate\`"