#! /bin/sh

# This script runs pychecker on the SCons source and creates a file called
# checks.txt with the results. It must be run in the src/engine directory.

base=`basename $PWD`
if [ "$base" != "engine" ]; then
   echo "You must run this script from the engine directory."
   exit
fi

DEVDIR=../../doc/developer
SRCFILE=../../bin/files
CHKFILE=checks.txt

rm -f $CHKFILE
for f in `cat $SRCFILE` ; do
   echo >> $CHKFILE
   echo " --- $f ---" >> $CHKFILE
   env PYTHONPATH=. pychecker -T -z -Z --deprecated $f >> $CHKFILE
done

if [ -e $CHKFILE ]; then
   sed -e "s|$PWD/||" $CHKFILE > /tmp/tmpchk
   mv -f /tmp/tmpchk $CHKFILE
fi