dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
527b56
From acbf558c486ee3518aca74045504f05872da4a58 Mon Sep 17 00:00:00 2001
527b56
From: Lumir Balhar <lbalhar@redhat.com>
527b56
Date: Tue, 26 Sep 2023 13:14:44 +0200
527b56
Subject: [PATCH] brp-python-bytecompile compatibility with newer pythons
527b56
527b56
---
527b56
 scripts/brp-python-bytecompile | 8 ++++----
527b56
 1 file changed, 4 insertions(+), 4 deletions(-)
527b56
527b56
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
527b56
index 4a9b49e..472bf10 100644
527b56
--- a/scripts/brp-python-bytecompile
527b56
+++ b/scripts/brp-python-bytecompile
527b56
@@ -58,7 +58,7 @@ EOF
527b56
 # and below /usr/lib/python3.1/, we're targeting /usr/bin/python3.1
527b56
 
527b56
 shopt -s nullglob
527b56
-for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/usr/lib(64)?/python[0-9]\.[0-9]$"`;
527b56
+for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/usr/lib(64)?/python[0-9]\.[0-9]+$"`;
527b56
 do
527b56
 	python_binary=/usr/bin/$(basename $python_libdir)
527b56
 	if [ "$python_binary" = "/usr/bin/python3.6" ]; then
527b56
@@ -97,17 +97,17 @@ fi
527b56
 
527b56
 # Figure out if there are files to be bytecompiled with the default_python at all
527b56
 # this prevents unnecessary default_python invocation
527b56
-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
527b56
+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
527b56
 
527b56
 # Generate normal (.pyc) byte-compiled files.
527b56
-python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
527b56
+python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]+|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
527b56
 if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
527b56
 	# One or more of the files had a syntax error
527b56
 	exit 1
527b56
 fi
527b56
 
527b56
 # Generate optimized (.pyo) byte-compiled files.
527b56
-python_bytecompile "-O" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
527b56
+python_bytecompile "-O" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]+|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
527b56
 if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
527b56
 	# One or more of the files had a syntax error
527b56
 	exit 1
527b56
-- 
527b56
2.41.0
527b56