Merge branch 'master' into awhitening
[aubio.git] / scripts / setenv_local.sh
1 #! /usr/bin/env bash
2
3 # This script sets the environment to execute aubio binaries and python code
4 # directly from build/ python/build/ without installing libaubio on the system
5
6 # Usage: $ source ./scripts/setenv_local.sh
7
8 # WARNING: this script will *overwrite* existing (DY)LD_LIBRARY_PATH and
9 # PYTHONPATH variables.
10
11 PYTHON_PLATFORM=`python -c "import pkg_resources, sys; print ('%s-%s' % (pkg_resources.get_build_platform(), '.'.join(map(str, sys.version_info[0:2]))))"`
12
13 AUBIODIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
14 AUBIOLIB=$AUBIODIR/build/src
15 AUBIOPYTHON=$AUBIODIR/build/lib.$PYTHON_PLATFORM
16
17 if [ "$(dirname $PWD)" == "scripts" ]; then
18   AUBIODIR=$(basename $PWD)
19 else
20   AUBIODIR=$(basename $PWD)
21 fi
22
23 if [ "$(uname)" == "Darwin" ]; then
24   export DYLD_LIBRARY_PATH=$AUBIOLIB
25   echo export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
26 else
27   export LD_LIBRARY_PATH=$AUBIOLIB
28   echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
29 fi
30
31 export PYTHONPATH=$AUBIOPYTHON
32 echo export PYTHONPATH=$PYTHONPATH