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
parent 1ea9947b6f
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}

View File

@ -1,6 +1,6 @@
Name: python-rpm-macros
Version: 3
Release: 31%{?dist}
Release: 32%{?dist}
Summary: The unversioned Python RPM macros
License: MIT
@ -71,6 +71,10 @@ install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} \
%changelog
* Tue Jul 10 2018 Tomas Orsava <torsava@redhat.com> - 3-32
- Fix %%py_byte_compile macro: when invoked with a Python 2 binary it also
mistakenly ran py3_byte_compile
* Tue Jul 03 2018 Miro Hrončok <mhroncok@redhat.com> - 3-31
- Add %%python3_platform useful for PYTHONPATH on arched builds