Iryna Shcherbina 412abe
From cc1a08b4a5222e74cae46ee17d4ef297ed63c2a9 Mon Sep 17 00:00:00 2001
Iryna Shcherbina 412abe
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Iryna Shcherbina 412abe
Date: Tue, 8 Aug 2017 12:27:48 +0200
Iryna Shcherbina 412abe
Subject: [PATCH] Bytecompile stuff in /usr/lib*/platform-python with
Iryna Shcherbina 412abe
 platform-python
Iryna Shcherbina 412abe
Iryna Shcherbina 412abe
---
Iryna Shcherbina 412abe
 scripts/brp-python-bytecompile | 14 ++++++++++----
Iryna Shcherbina 412abe
 1 file changed, 10 insertions(+), 4 deletions(-)
Iryna Shcherbina 412abe
Iryna Shcherbina 412abe
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
Iryna Shcherbina 412abe
index 894fa3459..92460b982 100644
Iryna Shcherbina 412abe
--- a/scripts/brp-python-bytecompile
Iryna Shcherbina 412abe
+++ b/scripts/brp-python-bytecompile
Iryna Shcherbina 412abe
@@ -57,9 +57,15 @@ EOF
Iryna Shcherbina 412abe
 # and below /usr/lib/python3.1/, we're targeting /usr/bin/python3.1
Iryna Shcherbina 412abe
 
Iryna Shcherbina 412abe
 shopt -s nullglob
Iryna Shcherbina 412abe
-for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/usr/lib(64)?/python[0-9]\.[0-9]$"`;
Iryna Shcherbina 412abe
+for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/usr/lib(64)?/(platform-)?python[0-9]\.[0-9]$"`;
Iryna Shcherbina 412abe
 do
Iryna Shcherbina 412abe
-	python_binary=/usr/bin/$(basename $python_libdir)
Iryna Shcherbina 412abe
+	python_basename=$(basename $python_libdir)
Iryna Shcherbina 412abe
+	if [[ $python_basename == platform* ]];
Iryna Shcherbina 412abe
+	then
Iryna Shcherbina 412abe
+		python_binary=/usr/libexec/$python_basename
Iryna Shcherbina 412abe
+	else
Iryna Shcherbina 412abe
+		python_binary=/usr/bin/$python_basename
Iryna Shcherbina 412abe
+	fi
Iryna Shcherbina 412abe
 	real_libdir=${python_libdir/$RPM_BUILD_ROOT/}
Iryna Shcherbina 412abe
 	echo "Bytecompiling .py files below $python_libdir using $python_binary"
Iryna Shcherbina 412abe
 
Iryna Shcherbina 412abe
@@ -88,14 +94,14 @@ if [ ! -x "$default_python" ]; then
Iryna Shcherbina 412abe
 fi
Iryna Shcherbina 412abe
 
Iryna Shcherbina 412abe
 # Generate normal (.pyc) byte-compiled files.
Iryna Shcherbina 412abe
-python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
Iryna Shcherbina 412abe
+python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/(platform-)?python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
Iryna Shcherbina 412abe
 if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
Iryna Shcherbina 412abe
 	# One or more of the files had a syntax error
Iryna Shcherbina 412abe
 	exit 1
Iryna Shcherbina 412abe
 fi
Iryna Shcherbina 412abe
 
Iryna Shcherbina 412abe
 # Generate optimized (.pyo) byte-compiled files.
Iryna Shcherbina 412abe
-python_bytecompile "-O" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
Iryna Shcherbina 412abe
+python_bytecompile "-O" $default_python "/bin/|/sbin/|/usr/lib(64)?/(platform-)?python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
Iryna Shcherbina 412abe
 if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
Iryna Shcherbina 412abe
 	# One or more of the files had a syntax error
Iryna Shcherbina 412abe
 	exit 1
Iryna Shcherbina 412abe
-- 
Iryna Shcherbina 412abe
2.13.3
Iryna Shcherbina 412abe