#!/bin/sh -e

# find a Python 2.6 binary
pyver=2.6
for dir in /usr/bin /usr/local/bin /Library/Frameworks/Python.framework/Versions/$pyver/bin /System/Library/Frameworks/Python.framework/Versions/$pyver/bin; do 
    if [ -e $dir/python$pyver ]; then
		PYTHON=$dir/python$pyver
		break
    fi
done

if [ -z $PYTHON ]; then
    echo ERROR: Unable to find a Python $pyver binary
    exit 1
fi


# and all of the wxPython package should be group writable

# install a .pth file in any Python installs we can find
for dir in /Library/Python/$pyver/site-packages /Library/Frameworks/Python.framework/Versions/$pyver/lib/python$pyver/site-packages; do
    if [ -d $dir ]; then
        echo Writing gammu.pth in $dir
        DEST=`dirname /usr/lib/python$pyver/site-packages/gammu`
        cat > $dir/gammu.pth <<pthEOF
import site; site.addsitedir('$DEST')
pthEOF
    fi
done

exit 0
