aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tests/regression/scripts/check_python_syntax.sh
diff options
context:
space:
mode:
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 $?