aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tests/regression/scripts/check_python_syntax.sh
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-07-28 16:38:08 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-07-28 16:38:08 +0100
commit59efc1880b0cc36fce0411ad230edf1193dc54ef (patch)
tree283a4a2524f9e72bee7256ae305b7902b6ac6e75 /tools/tests/regression/scripts/check_python_syntax.sh
parentd7de9aa5e814fd7bab0849af17f3fe3a888203bc (diff)
downloadxen-59efc1880b0cc36fce0411ad230edf1193dc54ef.tar.gz
xen-59efc1880b0cc36fce0411ad230edf1193dc54ef.tar.bz2
xen-59efc1880b0cc36fce0411ad230edf1193dc54ef.zip
tools/tests: Add syntax check for different versions of python
From: Andreas Florath <xen@flonatel.org> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'tools/tests/regression/scripts/check_python_syntax.sh')
-rw-r--r--tools/tests/regression/scripts/check_python_syntax.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/tests/regression/scripts/check_python_syntax.sh b/tools/tests/regression/scripts/check_python_syntax.sh
new file mode 100644
index 0000000000..8f7ce4e872
--- /dev/null
+++ b/tools/tests/regression/scripts/check_python_syntax.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Checks the syntax of all .py files
+# (compiles them into .pyc files)
+#
+
+XEN_ROOT=$1
+p=$2
+
+echo "Syntax check for $p"
+PYTHON_EXECUTABLE=`echo $p | tr -d "-"`
+export LD_LIBRARY_PATH=${XEN_ROOT}/tests/installed/$p/lib
+export PATH=${XEN_ROOT}/tests/installed/$p/bin:$PATH
+# -m is available starting with python 2.4
+# When support for 2.3 (and earlier) is dropped,
+# the following line will do.
+# ${PYTHON_EXECUTABLE} -m compileall -f -q -x ".*\.hg.*|^\.\./tests/installed.*" ..
+${PYTHON_EXECUTABLE} ${XEN_ROOT}/tests/installed/$p/lib/${PYTHON_EXECUTABLE}/compileall.py -f -q -x ".*\.hg.*|.*/tests/installed.*" ..
+exit $?