37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
|
|
index 894fa34..c06bdfa 100644
|
|
--- a/scripts/brp-python-bytecompile
|
|
+++ b/scripts/brp-python-bytecompile
|
|
@@ -1,5 +1,6 @@
|
|
#!/bin/bash
|
|
errors_terminate=$2
|
|
+extra=$3
|
|
|
|
# If using normal root, avoid changing anything.
|
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
|
@@ -79,14 +80,22 @@ do
|
|
done
|
|
|
|
|
|
-# Handle other locations in the filesystem using the default python
|
|
-# implementation - if we have a default python interpreter
|
|
+# Handle other locations in the filesystem using the default python implementation
|
|
+# if extra is set to 0, don't do this
|
|
+if [ 0$extra -eq 0 ]; then
|
|
+ exit 0
|
|
+fi
|
|
|
|
+# If we don't have a default python interpreter, we cannot proceed
|
|
default_python=${1:-/usr/bin/python}
|
|
if [ ! -x "$default_python" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
+# Figure out if there are files to be bytecompiled with the default_python at all
|
|
+# this prevents unnecessary default_python invocation
|
|
+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
|
|
+
|
|
# Generate normal (.pyc) byte-compiled files.
|
|
python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
|
|
if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
|