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.

Revisions

  1. mkohler revised this gist Jul 1, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions install
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    #!/bin/sh
    cp postmkvirtualenv ~/.virtualenvs
  2. mkohler revised this gist Jul 1, 2014. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions postmkvirtualenv
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,12 @@
    #!/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 )
    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) )
    @@ -14,4 +18,4 @@ 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
    done
  3. José Luis Lafuente revised this gist Nov 1, 2012. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions postmkvirtualenv
    Original file line number Diff line number Diff line change
    @@ -2,16 +2,16 @@
    # This hook is run after a new virtualenv is activated.
    # ~/.virtualenvs/postmkvirtualenv

    LIBS=( PyQt4 sip.so )
    libs=( PyQt4 sip.so )

    PYTHON_VERSION=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))")
    VAR=( $(which -a $PYTHON_VERSION) )
    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")
    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[@]}
    for lib in ${libs[@]}
    do
    ln -s $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB
    ln -s $lib_system_path/$lib $lib_virtualenv_path/$lib
    done
  4. José Luis Lafuente created this gist Mar 15, 2012.
    17 changes: 17 additions & 0 deletions postmkvirtualenv
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/bin/bash
    # This hook is run after a new virtualenv is activated.
    # ~/.virtualenvs/postmkvirtualenv

    LIBS=( PyQt4 sip.so )

    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