From 312bfbac2624179f80025a8d33c0175e754c2f57 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 22 Jan 2020 13:09:31 +0100 Subject: [PATCH] Use `-B` flag for Python when using compileall2 to not write pyc files The Python compileall2 module in /usr/lib/rpm/redhat/ can be executed by various different Python interpreters. We don't want to write several different `*.pyc` files to this location - in most cases, that's not possible, but somebody might run this as root. --- brp-python-bytecompile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brp-python-bytecompile b/brp-python-bytecompile index ede435b..ed1563b 100755 --- a/brp-python-bytecompile +++ b/brp-python-bytecompile @@ -48,7 +48,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 $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)