Skip to content

Instantly share code, notes, and snippets.

@mkohler
Forked from jlesquembre/postmkvirtualenv
Last active August 29, 2015 14:03
Show Gist options
  • Save mkohler/b7a3233bccd1474e824e to your computer and use it in GitHub Desktop.
Save mkohler/b7a3233bccd1474e824e to your computer and use it in GitHub Desktop.
#!/bin/sh
cp postmkvirtualenv ~/.virtualenvs
#!/bin/bash
# Since "pip install pyqt4" doesn't work for whatever reason, this
# script puts the global version of PyQt and SIP in each virtualenv.
# This hook is run after a new virtualenv is activated.
# ~/.virtualenvs/postmkvirtualenv
libs=( PyQt4 sip.so sipconfig.py sipconfig_nd.py sipdistutils.py )
python_version=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))")
var=( $(which -a $python_version) )
get_python_lib_cmd="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
lib_virtualenv_path=$(python -c "$get_python_lib_cmd")
lib_system_path=$(${var[-1]} -c "$get_python_lib_cmd")
for lib in ${libs[@]}
do
ln -s $lib_system_path/$lib $lib_virtualenv_path/$lib
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment