#!/bin/sh
#set -e

. kumatux.org-vars
APPNAME=`basename $1 | sed 's/_.*//'`
for PYVER in $KUMATUXPYTHONVERSIONS
do
    if [ -d $1/lib/python$PYVER/site-packages -a ! $APPNAME = python ]
    then
	SEARCH="lib/python$PYVER/site-packages"
	ROOTDIR=$KUMATUXROOTPYTHON
	ETCDIR=$KUMATUXETCPYTHON

## check whether app already linked
	LINKED=`$KUMATUXFIND/linked-allready.sh $1 $ROOTDIR $SEARCH`
	if [ "$LINKED" ]
	then
## don't link
	    echo "$1/$SEARCH linked already in $LINKED"
	else
## link
	    $KUMATUXLINK/python-link.sh $1 $SEARCH $ETCDIR $ROOTDIR $PYVER
	fi
    fi
done

## link python into /usr/lib/
#if [ $APPNAME = "python" ]
#then
#    $KUMATUXLINK/python-usr-lib.sh $1
#fi
