Created
February 28, 2014 07:30
-
-
Save tonyseek/9266835 to your computer and use it in GitHub Desktop.
The wrapper for running wxPython in virtualenv.
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
#!/usr/bin/env sh | |
PYTHON_VERSION=2.7 | |
WXPYTHON_ROOT="$(brew --prefix wxwidgets)/lib/python${PYTHON_VERSION}/site-packages" | |
WXPYTHON_SITE_ROOT="${WXPYTHON_ROOT}/$(cat ${WXPYTHON_ROOT}/wx.pth)" | |
SYSTEM_PYTHON=/usr/bin/python | |
# find the root of the virtualenv, it should be the parent of the dir this script is in | |
ENV=`${SYSTEM_PYTHON} -c "import os; print os.path.abspath(os.path.join(os.path.dirname(\"$0\"), '..'))"` | |
# now run Python with the virtualenv set as Python's HOME | |
export PYTHONPATH="${WXPYTHON_SITE_ROOT}:${PYTHONPATH}" | |
export PYTHONHOME="${ENV}" | |
exec $SYSTEM_PYTHON "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment