f17b98
commit 7cf1ad2dbb5af9b9012ba67b9687ad28c02578d6
f17b98
Author: Panu Matilainen <pmatilai@redhat.com>
f17b98
Date:   Wed Feb 3 12:52:30 2010 +0200
f17b98
f17b98
    Enable strict python bytecompile mode (if rpm supports it)
f17b98
    - with %_python_bytecompile_errors_terminate_build set to non-zero,
f17b98
      byte-compilation errors will abort the build, this helps catch out
f17b98
      silly "improt foo" syntax errors early on
f17b98
    - not all .py files are valid python (they can be templates, inteded for
f17b98
      jython consumption etc), and what's valid can depend on the python
f17b98
      version (notably 2.x vs 3.x) so allow overriding from spec
f17b98
f17b98
diff --git a/macros b/macros
f17b98
index 77844f0..7721fe0 100644
f17b98
--- a/macros
f17b98
+++ b/macros
f17b98
@@ -95,7 +95,7 @@
f17b98
     %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip}} \
f17b98
     /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
f17b98
     /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
f17b98
-    /usr/lib/rpm/brp-python-bytecompile %{__python} \
f17b98
+    /usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} \
f17b98
     /usr/lib/rpm/redhat/brp-python-hardlink \
f17b98
     %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
f17b98
 %{nil}
f17b98
@@ -167,6 +167,10 @@ unset DISPLAY\
f17b98
 # Should unpackaged files in a build root terminate a build?
f17b98
 %_unpackaged_files_terminate_build    1
f17b98
 
f17b98
+#
f17b98
+## Should python bytecompilation errors terminate a build?
f17b98
+%_python_bytecompile_errors_terminate_build 1
f17b98
+
f17b98
 # Use SHA-256 for FILEDIGESTS instead of default MD5
f17b98
 %_source_filedigest_algorithm 8
f17b98
 %_binary_filedigest_algorithm 8