From c487f82ef751f1277a59a80c0fc2cd4efea0b65b Mon Sep 17 00:00:00 2001 From: Ben Burton Date: Mon, 19 Apr 2021 21:02:49 +0200 Subject: [PATCH] Adapt macros and BRP scripts for %topdir with spaces Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1947416 --- brp-python-bytecompile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/brp-python-bytecompile b/brp-python-bytecompile index ead7022..71f4d2d 100755 --- a/brp-python-bytecompile +++ b/brp-python-bytecompile @@ -38,7 +38,7 @@ function python_bytecompile() local options=$1 local python_binary=$2 local exclude=$3 - local python_libdir=$4 + local python_libdir="$4" local depth=$5 # Not used for Python >= 3.4 local real_libdir=$6 # Not used for Python >= 3.4 @@ -57,7 +57,7 @@ function python_bytecompile() # -x and -e together implements the same functionality as the Filter class below # -s strips $RPM_BUILD_ROOT from the path # -p prepends the leading slash to the path to make it absolute - $python_binary -B $options -m compileall -q -f $exclude -s $RPM_BUILD_ROOT -p / -e $RPM_BUILD_ROOT $python_libdir + $python_binary -B $options -m compileall -q -f $exclude -s "$RPM_BUILD_ROOT" -p / -e "$RPM_BUILD_ROOT" "$python_libdir" # # Python 3.4 and higher @@ -73,7 +73,7 @@ function python_bytecompile() # -x and -e together implements the same functionality as the Filter class below # -s strips $RPM_BUILD_ROOT from the path # -p prepends the leading slash to the path to make it absolute - PYTHONPATH=/usr/lib/rpm/redhat/ $python_binary -B $options -m compileall2 -q -f $exclude -s $RPM_BUILD_ROOT -p / -e $RPM_BUILD_ROOT $python_libdir + PYTHONPATH=/usr/lib/rpm/redhat/ $python_binary -B $options -m compileall2 -q -f $exclude -s "$RPM_BUILD_ROOT" -p / -e "$RPM_BUILD_ROOT" "$python_libdir" else # # Python 3.3 and lower (incl. Python 2) @@ -119,9 +119,9 @@ fi export PYTHONHASHSEED=0 shopt -s nullglob -for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/(usr|app)/lib(64)?/python[0-9]\.[0-9]+$"`; +find "$RPM_BUILD_ROOT" -type d -print0|grep -z -E "/(usr|app)/lib(64)?/python[0-9]\.[0-9]+$" | while read -d "" python_libdir; do - python_binary=$(basename $python_libdir) + python_binary=$(basename "$python_libdir") real_libdir=${python_libdir/$RPM_BUILD_ROOT/} echo "Bytecompiling .py files below $python_libdir using $python_binary"