teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.6.0-python-validate.patch

Panu Matilainen 86a792
diff -up rpm-4.6.0/scripts/brp-python-bytecompile.validate rpm-4.6.0/scripts/brp-python-bytecompile
Panu Matilainen 86a792
--- rpm-4.6.0/scripts/brp-python-bytecompile.validate	2009-02-20 20:31:30.000000000 +0200
Panu Matilainen 86a792
+++ rpm-4.6.0/scripts/brp-python-bytecompile	2009-02-20 20:31:37.000000000 +0200
Panu Matilainen 86a792
@@ -20,7 +20,12 @@ if [ -z "$depth" -o "$depth" -le "1" ]; 
Panu Matilainen 86a792
 fi
Panu Matilainen 86a792
 
Panu Matilainen 86a792
 # Generate normal (.pyc) byte-compiled files.
Panu Matilainen 86a792
-$python    -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1)' > /dev/null
Panu Matilainen 86a792
+$python    -c 'import compileall, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, quiet=1))'
Panu Matilainen 86a792
+if [ $? != 0 ]; then
Panu Matilainen 86a792
+  # One or more of the files has a syntax error.
Panu Matilainen 86a792
+  exit 1
Panu Matilainen 86a792
+fi
Panu Matilainen 86a792
+
Panu Matilainen 86a792
 
Panu Matilainen 86a792
 # Generate optimized (.pyo) byte-compiled files.
Panu Matilainen 86a792
 $python -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1)' > /dev/null