From 40366fa94ec09a10f93732c0bf042a29ec866a29 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 12 Mar 2015 22:12:15 +1100 Subject: Virtualenv is the one and only recommended dev environment - Create a "dev" script to create a virtualenv-based dev environment - Update the docs to remove non-virtualenv install recommendations - Update osx-binaries generation to use virtualenv TODO: - The dev script or an equivalent should be made to work on Windows - We still can't remove the annoying top-level command scripts, because pyinstaller doesn't support entry points. Once it does, they can go. --- release/osx-binaries | 68 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 28 deletions(-) (limited to 'release/osx-binaries') diff --git a/release/osx-binaries b/release/osx-binaries index d2af5e18..990d047d 100755 --- a/release/osx-binaries +++ b/release/osx-binaries @@ -2,32 +2,44 @@ # Quick and dangerous script for building OSX binaries. -# A few quirks to note, which should be re-checked every release: -# - We require the latest development version of PyInstaller. - -# To run, first install netlib and mitmproxy, then run -# -# ./release/osx-binaries -# -# From the top-level mitmproxy directory. - -usage () -{ - echo 'Usage : ./release/osx-binaries /path/to/pyinstaller.py' - echo 'Run from the top-level mitmproxy directory' - exit -} - -if [ "$1" = "" ] +# At the moment, pyinstaller has no support for entry points, except for this +# hideous hack on the wiki: +# https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Setuptools-Entry-Point +# Once this is fixed, we can ditch the redundant command scripts. + +VENV=../venv.mitmproxy +PYINST_CMD="$VENV/bin/pyinstaller -F --clean" +TMPDIR=./tmp +CACHE="~/Library/Application Support/pyinstaller" + + +if [ ! -d $VENV ] then - usage + echo "Failed: set up a dev environment as described in the README" + echo "and run from the top-level mitmproxy directory." + exit fi +source $VENV/bin/activate -TMPDIR=./tmp -PYINST_CMD=$1" -F --clean" -CACHE="~/Library/Application Support/pyinstaller" +if [ ! -f $VENV/bin/pyinstaller ] + then + echo "Installing pyinstaller..." + $VENV/bin/pip install \ + --force-reinstall \ + --upgrade \ + https://github.com/pyinstaller/pyinstaller/archive/develop.zip + $VENV/bin/pip install --upgrade macholib +fi + +# readline.so is actually a symlink to a Python file, which breaks PyInstaller +# (and readline itself). Why? Who knows. Re-address this when this stupidity +# ceases to be. +echo "Removing broken readline..." +rm -f $VENV/lib/python2.7/readline.so + +echo "Clearing caches..." rm -f dist/* rm -rf $TMPDIR rm -rf $CACHE @@ -36,14 +48,14 @@ $PYINST_CMD ./release/mitmdump.spec echo "Running mitmdump..." ./dist/mitmdump --version || exit 1 -$PYINST_CMD ./release/mitmproxy.spec -echo "Running mitmproxy..." -./dist/mitmproxy --version || exit 1 - -$PYINST_CMD ./release/mitmweb.spec -echo "Running mitmweb..." -./dist/mitmweb --version || exit 1 +#$PYINST_CMD ./release/mitmproxy.spec +#echo "Running mitmproxy..." +#./dist/mitmproxy --version || exit 1 +#$PYINST_CMD ./release/mitmweb.spec +#echo "Running mitmweb..." +#./dist/mitmweb --version || exit 1 +exit DST=osx-mitmproxy-`./dist/mitmdump --shortversion 2>&1` mkdir -p $TMPDIR/$DST cp ./dist/mitmproxy $TMPDIR/$DST -- cgit v1.2.3