dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
3f9d64
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
3f9d64
index 894fa3459..47776215a 100644
3f9d64
--- a/scripts/brp-python-bytecompile
3f9d64
+++ b/scripts/brp-python-bytecompile
3f9d64
@@ -87,6 +87,10 @@ if [ ! -x "$default_python" ]; then
3f9d64
 	exit 0
3f9d64
 fi
3f9d64
 
3f9d64
+# Figure out if there are files to be bytecompiled with the default_python at all
3f9d64
+# this prevents unnecessary default_python invocation
3f9d64
+find "$RPM_BUILD_ROOT" -type f -name "*.py" | grep -Ev "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" || exit 0
3f9d64
+
3f9d64
 # Generate normal (.pyc) byte-compiled files.
3f9d64
 python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
3f9d64
 if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then