#!/bin/sh
WORKING_PATH=$(dirname $0)
cd $WORKING_PATH
WORKING_PATH=$(pwd)
rm -f dists.py dists.pyo dists.pyc 
rm -rf ~/.listen-trunk/daapcache
find . -iname \*.pyo -exec rm {} \;
export LISTEN_LIBRARY_PATH=$WORKING_PATH
if [ "$1" = "-v" ];  then
    shift
    export G_SLICE=always-malloc
    export G_DEBUG=gc-friendly
    export GLIBCXX_FORCE_NEW=1
    rm -f x-valgrind
    valgrind --tool=memcheck --suppressions=valgrind-python.supp --log-file=x-valgrind python -E listen "$@"
    #--leak-check=full --leak-resolution=high --num-callers=64 
    #--show-reachable=yes 
   
else
    exec python -OO listen "$@" --debug 9
fi
