summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-02-20 21:44:13 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-02-20 21:44:13 +0200
commit89a7b15c22df2c36d4fe85a5e08240a6044ef505 (patch)
tree7464ac98a61ee8dda64711cfc5ee3f94807d424a
parent519f8fce17fa9fbfabc5673bee1f5b3c23147306 (diff)
downloadrpm-89a7b15c22df2c36d4fe85a5e08240a6044ef505.tar.gz
rpm-89a7b15c22df2c36d4fe85a5e08240a6044ef505.tar.bz2
rpm-89a7b15c22df2c36d4fe85a5e08240a6044ef505.zip
Check for errors from python bytecompile (Tim Waugh)
- since we're byte-compiling all python pieces, might as well use the opportunity to catch syntax errors while at it
-rw-r--r--scripts/brp-python-bytecompile6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
index 5aae31a01..5f853d711 100644
--- a/scripts/brp-python-bytecompile
+++ b/scripts/brp-python-bytecompile
@@ -20,7 +20,11 @@ if [ -z "$depth" -o "$depth" -le "1" ]; then
fi
# Generate normal (.pyc) byte-compiled files.
-$python -c 'import compileall, re; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/"'"))' > /dev/null
+$python -c 'import compileall, re, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/"'"), quiet=1))'
+if [ $? != 0 ]; then
+ # One or more of the files had a syntax error
+ exit 1
+fi
# Generate optimized (.pyo) byte-compiled files.
$python -O -c 'import compileall, re; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/"'"))' > /dev/null