Igor Gnatenko 082d5d
From aa74f749e8eba102069aaafd0b2e18af8f5f0fa0 Mon Sep 17 00:00:00 2001
Florian Festi e38c40
From: Florian Festi <ffesti@redhat.com>
Florian Festi e38c40
Date: Tue, 14 Feb 2017 14:04:35 +0100
Igor Gnatenko 082d5d
Subject: [PATCH 02/49] brp-python-bytecompile: Process python lib dirs even
Igor Gnatenko 082d5d
 without standard Python
Florian Festi e38c40
Florian Festi e38c40
There is no need for /usr/bin/python when byte compiling files in
Florian Festi e38c40
/usr/lib/pythonX.Y (only /usr/bin/pythonX.Y). Moved check so we do not exit
Florian Festi e38c40
prematurely.
Florian Festi e38c40
Florian Festi e38c40
Fixes: rhbz#1411588
Igor Gnatenko 082d5d
(cherry picked from commit a8e51b3bb05c6acb1d9b2e3d34f859ddda1677be)
Florian Festi e38c40
---
Florian Festi e38c40
 scripts/brp-python-bytecompile | 13 ++++++-------
Florian Festi e38c40
 1 file changed, 6 insertions(+), 7 deletions(-)
Florian Festi e38c40
Florian Festi e38c40
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
Igor Gnatenko 082d5d
index 838f23d9d..894fa3459 100644
Florian Festi e38c40
--- a/scripts/brp-python-bytecompile
Florian Festi e38c40
+++ b/scripts/brp-python-bytecompile
Florian Festi e38c40
@@ -6,12 +6,6 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
Florian Festi e38c40
 	exit 0
Florian Festi e38c40
 fi
Florian Festi e38c40
 
Florian Festi e38c40
-# If we don't have a python interpreter, avoid changing anything.
Florian Festi e38c40
-default_python=${1:-/usr/bin/python}
Florian Festi e38c40
-if [ ! -x "$default_python" ]; then
Florian Festi e38c40
-	exit 0
Florian Festi e38c40
-fi
Florian Festi e38c40
-
Florian Festi e38c40
 # Figure out how deep we need to descend.  We could pick an insanely high
Florian Festi e38c40
 # number and hope it's enough, but somewhere, somebody's sure to run into it.
Florian Festi e38c40
 depth=`(find "$RPM_BUILD_ROOT" -type f -name "*.py" -print0 ; echo /) | \
Florian Festi e38c40
@@ -86,7 +80,12 @@ done
Florian Festi e38c40
 
Florian Festi e38c40
 
Florian Festi e38c40
 # Handle other locations in the filesystem using the default python
Florian Festi e38c40
-# implementation:
Florian Festi e38c40
+# implementation - if we  have a default python interpreter
Florian Festi e38c40
+
Florian Festi e38c40
+default_python=${1:-/usr/bin/python}
Florian Festi e38c40
+if [ ! -x "$default_python" ]; then
Florian Festi e38c40
+	exit 0
Florian Festi e38c40
+fi
Florian Festi e38c40
 
Florian Festi e38c40
 # Generate normal (.pyc) byte-compiled files.
Florian Festi e38c40
 python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
Florian Festi e38c40
-- 
Igor Gnatenko 082d5d
2.13.2
Florian Festi e38c40