Blame SOURCES/redhat-rpm-config-9.1.0-strict-python-bytecompile.patch

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