Bug 1484993
Summary: | %py_byte_compile broken with Python 2: compile() got an unexpected keyword argument 'optimize' | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Rolf Fokkens <rolf> |
Component: | python3 | Assignee: | Charalampos Stratakis <cstratak> |
Status: | CLOSED DUPLICATE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 27 | CC: | bkabrda, cstratak, dmalcolm, ishcherb, jdisnard, lzachar, mcyprian, mebrown, mhroncok, msimacek, msuchy, praiskup, pviktori, rkuska, terje.rosten, tomspur, torsava |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2018-01-05 11:11:05 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1523906 |
Description
Rolf Fokkens
2017-08-24 19:16:23 UTC
This macro comes from: /usr/lib/rpm/macros.d/macros.pybytecompile3.6 which is owned by python3-devel-3.6.3-2.fc27.x86_64 It calls py_compile.compile() with argument 'optimize' which seems does not exists on python2 https://docs.python.org/2/library/py_compile.html#py_compile.compile It exist only in python3. This is clearly python issue. Note that according to documentation [1], the %py_byte_compile macro indeed should work with both Pythons. [1] https://fedoraproject.org/wiki/Packaging:Python_Appendix#Manual_byte_compilation The macro was updated when going from Python 3.4 to 3.5 (i.e. Fedora 23 to Fedora 24). https://src.fedoraproject.org/rpms/python3/blob/f23/f/macros.pybytecompile3.4 https://src.fedoraproject.org/rpms/python3/blob/f24/f/macros.pybytecompile3.5 If I remember correctly, the old version didn't work with Python 3.5, so an update was done, while not being Python 2 compatible, this was probably unnoticed ever since, because the situation described in the guidelines (linked as [1] in my previous) is not very common. We'll definitively need to fix this somehow. In the meantime, if you share the entire spec, I might be able to provide a workaround for you. I need this since recoll started to ship filters written in both Python 2 and 3. Spec file snippet: # Turn off the brp-python-bytecompile script %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') [snip] # Mix of Python 2 and 3. Needs special care %py_byte_compile %{__python2} %{buildroot}%{python2_sitearch}/recoll for py in %{buildroot}%{_datadir}/%{name}/filters/*; do if [ "$(basename $py)" = "recoll-we-move-files.py" ]; then %py_byte_compile %{__python3} $py else %py_byte_compile %{__python2} $py fi done BTW: extending logic in brp-python-bytecompile to be a bit smarter should not be that hard? At least looking at shebang "#! /usr/bin/pythonX" should be possible? Marking this one as a duplicate, because the second one better summarizes what's wrong. *** This bug has been marked as a duplicate of bug 1531253 *** |