Skip to content

Commit

Permalink
always use 'venv' as virtualenv folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Jan 29, 2017
1 parent f570c57 commit 3fe2f95
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ To get started hacking on mitmproxy, please follow the `advanced installation`_
./dev.sh # "powershell .\dev.ps1" on Windows
The *dev* script will create a `virtualenv`_ environment in a directory called
"venv3.5", and install all mandatory and optional dependencies into it. The
primary mitmproxy components - mitmproxy and pathod - are installed as
The *dev* script will create a `virtualenv`_ environment in a directory called "venv"
and install all mandatory and optional dependencies into it. The primary
mitmproxy components - mitmproxy and pathod - are installed as
"editable", so any changes to the source in the repository will be reflected
live in the virtualenv.

Expand All @@ -82,7 +82,7 @@ you can run them like any other command:

.. code-block:: text
. venv3.5/bin/activate # "venv\Scripts\activate" on Windows
. venv/bin/activate # "venv\Scripts\activate" on Windows
mitmdump --version
Testing
Expand Down
7 changes: 3 additions & 4 deletions dev.ps1
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
$ErrorActionPreference = "Stop"
$VENV = ".\venv"

$pyver = python --version
if($pyver -notmatch "3\.[5-9]") {
Write-Warning "Unexpected Python version, expected Python 3.5 or above: $pyver"
}

python -m venv $VENV --copies
& $VENV\Scripts\activate.ps1
python -m venv .\venv --copies
& .\venv\Scripts\activate.ps1

python -m pip install --disable-pip-version-check -U pip
cmd /c "pip install -r requirements.txt 2>&1"

echo @"
* Created virtualenv environment in $VENV.
* Created virtualenv environment in .\venv.
* Installed all dependencies into the virtualenv.
* Activated virtualenv environment.
Expand Down
18 changes: 8 additions & 10 deletions dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
set -e
set -x

PYVERSION=${1:-3.5}
VENV="venv$PYVERSION"
echo "Creating dev environment in ./venv..."

echo "Creating dev environment in $VENV using Python $PYVERSION"

python$PYVERSION -m venv "$VENV"
. "$VENV/bin/activate"
pip$PYVERSION install -U pip setuptools
pip$PYVERSION install -r requirements.txt
python3 -m venv venv
. venv/bin/activate
pip3 install -U pip setuptools
pip3 install -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\`"
echo " * Created virtualenv environment in ./venv."
echo " * Installed all dependencies into the virtualenv."
echo " * You can now activate the $(python3 --version) virtualenv with this command: \`. venv/bin/activate\`"

0 comments on commit 3fe2f95

Please sign in to comment.