File: check.sh

package info (click to toggle)
bitpim 0.9.08.dfsg.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 24,228 kB
  • ctags: 45,773
  • sloc: python: 191,894; cpp: 2,074; perl: 600; ansic: 343; sh: 185; makefile: 76; sed: 1
file content (107 lines) | stat: -rwxr-xr-x 2,763 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/sh

# $Id: check.sh 2916 2006-03-14 08:38:15Z rogerb $

# This script does various checks on the source code
# including epydoc and pychecker

EPYDOC=epydoc
PYCHECKERARGS="--only --limit 10000"
PYCHECKER="pychecker $PYCHECKERARGS"
PYXRDIR=
PYTHON=python # will probably want this to be python2.3 on rh9

case $MACHTYPE in
    *-msys ) # windows machine
        EPYDOC="python /c/python23/scripts/epydoc.py"
        PYCHECKER="python /c/python23/lib/site-packages/pychecker/checker.py $PYCHECKERARGS pychecker"
	PYXRDIR="/c/bin/pyxr"
	PATH="/usr/bin:$PATH"  # msys is usually not on path!
    ;;
    # other platforms fill in here
esac

# clean everything up
rm -rf apidoc pyxr
rm -f check.out

# a function that copies a directory tree to the website if we also have that module
copytowebsite() {
    # $1 is directory here
    # $2 is url path from root of website
    if [ ! -d "$1" ]
    then
	echo "$1 doesn't exist and cant be copied!"
	exit 1
    fi

    # this is how we detect the website - look for a bpweb checkout alongside this
    # directory
    if [ ! -d ../bpweb/site/.svn ]
    then
	return  # not found
    fi

    # ok, lets copy
    echo "Copying directory $1 to be on web site at url /$2"
    rm -rf ../bpweb/site/$2
    cp -r $1 ../bpweb/site/$2
}

# nice little function to see if a file is in subversion
isinsvn() {
    efile=`dirname $1`/.svn/entries
    grep -s "name=\"`basename $1`\"" $efile >/dev/null
}

# we look for all .py files in SVN
pyfiles="bp.py gui.py guiwidgets.py guihelper.py common.py" # we have to do this in this order first else python crashes

# find files in src
for f in `find src -name '*.py' -print |sed s@^src/@@ | sort`
do
    if isinsvn src/$f
    then
       case `basename $f` in
          p_*.py | __init__.py | setup.py | p2econfig.py ) # we don't want these
            true
         ;;   
         * )
	    case $f in
		native/evolution/* | native/outlook/* | native/qtopiadesktop/* | native/usb/* | native/wab/* )
                  # pychecker barfs on the above
		  true
                ;;
                *)
		  pyfiles="$pyfiles $f"
                ;;
	    esac
         ;;
       esac
    fi
done

pyfiles="`echo $pyfiles | sed 's/\.py//g' | sed 's@/@.@g'`"
pyfiles="$pyfiles native.evolution native.outlook native.qtopiadesktop native.usb native.wab"
echo $pyfiles

if [ "$EPYDOC" != "" ]
then
    PYTHONPATH=src $EPYDOC --check $pyfiles > check.out
    PYTHONPATH=src $EPYDOC -o apidoc  --css blue  -n bitpim -u http://www.bitpim.org $pyfiles
    copytowebsite apidoc apidoc
fi

if [ "$PYXRDIR" != "" ]
then
    oldpwd=`pwd`
    cd "$PYXRDIR"
    $PYTHON buildWeb.py
    cd "$oldpwd"
    copytowebsite pyxr pyxr
fi

if [ "$PYCHECKER" != "" ]
then
    PYTHONPATH=src $PYCHECKER $pyfiles
fi