Fix %%py_byte_compile macro

When invoked with a Python 2 binary it also mistakenly ran py3_byte_compile.
This commit is contained in:
Tomas Orsava 2018-07-10 15:02:20 +02:00
commit f961fbbc29
2 changed files with 6 additions and 2 deletions

View file

@ -21,5 +21,5 @@ py3_byte_compile () {\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2], optimize=opt) for opt in range(2) for f in sys.argv[1:]]' || :\
}\
\
[[ "%1" == *python3* ]] || py2_byte_compile "%1" "%2" && py3_byte_compile "%1" "%2" \
[[ "%1" != *python3* ]] && py2_byte_compile "%1" "%2" || py3_byte_compile "%1" "%2" \
%{nil}