1 #!/bin/bash 2 3 ANTLR_JOB=${1:-ANTLR_Tool} 4 ST_VERSION=3.1 5 ANTLR2_VERSION=2.7.7 6 7 # find the antlr.jar from the upstream project 8 JAR=$(ls $WORKSPACE/../../$ANTLR_JOB/lastSuccessful/org.antlr\$antlr/archive/org.antlr/antlr/*/antlr-*-jar-with-dependencies.jar) 9 echo "antlr.jar=$JAR" 10 11 if [ ! -f "$JAR" ]; then 12 echo "Could not find antlr.jar" 13 exit 1 14 fi 15 16 17 echo "************************************************************************" 18 echo "Setting up dependencies" 19 echo 20 21 rm -fr $WORKSPACE/tmp 22 mkdir -p $WORKSPACE/tmp 23 cd $WORKSPACE 24 25 # stringtemplate3 26 if [ ! -f stringtemplate3-$ST_VERSION.tar.gz ]; then 27 wget http://pypi.python.org/packages/source/s/stringtemplate3/stringtemplate3-$ST_VERSION.tar.gz 28 fi 29 (cd tmp; tar xzf ../stringtemplate3-$ST_VERSION.tar.gz) 30 (cd tmp/stringtemplate3-$ST_VERSION; python setup.py install --install-lib=$WORKSPACE) 31 32 # antlr2 33 if [ ! -f antlr-$ANTLR2_VERSION.tar.gz ]; then 34 wget http://www.antlr2.org/download/antlr-$ANTLR2_VERSION.tar.gz 35 fi 36 (cd tmp; tar xzf ../antlr-$ANTLR2_VERSION.tar.gz) 37 (cd tmp/antlr-$ANTLR2_VERSION/lib/python; python setup.py install --install-lib=$WORKSPACE) 38 39 40 export CLASSPATH=$JAR 41 42 echo "************************************************************************" 43 echo "Running the testsuite" 44 echo 45 46 cd $WORKSPACE 47 rm -fr testout/ 48 mkdir -p testout/ 49 python setup.py unittest --xml-output=testout/ 50 python setup.py functest --xml-output=testout/ --antlr-jar="$JAR" 51 52 53 echo "************************************************************************" 54 echo "Running pylint" 55 echo 56 57 cd $WORKSPACE 58 pylint --rcfile=pylintrc --output-format=parseable --include-ids=yes antlr3 | tee pylint-report.txt 59 60 61 echo "************************************************************************" 62 echo "Building dist files" 63 echo 64 65 cd $WORKSPACE 66 rm -f dist/* 67 cp -f $JAR dist/ 68 python setup.py sdist --formats=gztar,zip 69 for PYTHON in /usr/bin/python2.?; do 70 $PYTHON setup.py bdist_egg 71 done 72