#!/bin/sh # ccp4-python can be used before the setup is sourced (e.g. during build) CCP4="$(cd "$(dirname "$0")/.." && pwd)" # LIBTBX_BUILD is used in cctbx to find libtbx_env file (pickle) export LIBTBX_BUILD=$CCP4/lib/py2/cctbx # Old PYTHONPATH is ignored -- it may be set for different Python version. # Special case when Windows Python is called from MSYS/MinGW shell is handled # near to "python.exe" below (";" must be used as a separator in that case). export PYTHONPATH="$CCP4/lib/python2.7/site-packages:$CCP4/lib/py2:$CCP4/lib/py2/site-packages:$LIBTBX_BUILD/../site-packages/phaser:$LIBTBX_BUILD/../site-packages/tntbx:$LIBTBX_BUILD/../site-packages:$LIBTBX_BUILD/../site-packages/cctbx_project:$LIBTBX_BUILD/../site-packages/cctbx_project/boost_adaptbx:$LIBTBX_BUILD/../site-packages/cctbx_project/libtbx/pythonpath:$LIBTBX_BUILD/lib:$CCP4/share/python" # MSYS translates most of paths automatically, but it needs help here if [ "$(uname)" = MINGW32_NT-6.1 ]; then CCP4="$(cd "$CCP4" && pwd -W)" export PYTHONPATH="$CCP4/lib/python2.7/site-packages;$CCP4/lib/py2;$CCP4/lib/py2/site-packages;$LIBTBX_BUILD/../site-packages/phaser;$LIBTBX_BUILD/../site-packages/tntbx;$LIBTBX_BUILD/../site-packages;$LIBTBX_BUILD/../site-packages/cctbx_project;$LIBTBX_BUILD/../site-packages/cctbx_project/boost_adaptbx;$LIBTBX_BUILD/../site-packages/cctbx_project/libtbx/pythonpath;$LIBTBX_BUILD/lib;$CCP4/share/python" fi if test -d $CCP4/Frameworks/Python.framework; then export DYLD_LIBRARY_PATH=$CCP4/lib:$DYLD_LIBRARY_PATH exec $CCP4/Frameworks/Python.framework/Versions/2.7/bin/python2.7 "$@" elif test -e $CCP4/libexec/python2.7; then exec $CCP4/libexec/python2.7 "$@" # location in dev. build elif test -e $CCP4/../python2.7/python.exe; then exec $CCP4/../python2.7/python.exe "$@" # on Windows python is not in bin/ else # $CCP4/libexec/python has RPATH set to $CCP4/lib. LD_LIBRARY_PATH is # needed only for system Python, because extension modules on its own # don't have rpaths pointing to $CCP4/lib (yet) export LD_LIBRARY_PATH=$CCP4/lib:$LD_LIBRARY_PATH exec python2.7 "$@" # any python 2.7 should also be fine fi