Bug 1433569

Summary: %py_byte_compile doesn't work
Product: [Fedora] Fedora Reporter: Thomas Moschny <thomas.moschny>
Component: python3Assignee: Tomas Orsava <torsava>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: bkabrda, cstratak, ishcherb, mcyprian, mhroncok, pviktori, rkuska, tomspur, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3-3.6.1-0.2.rc1.fc27 python3-3.5.3-4.fc25 python3-3.6.0-22.fc26 python3-3.5.3-4.fc24 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-24 18:56:25 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:

Description Thomas Moschny 2017-03-18 07:39:58 UTC
Description of problem:
There's a syntax error in the Python statement in %py_byte_compile:

# that's what currently is in the macro
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:]]

# and that's how it should be
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:]]

(There's one ']' to be removed.)


Version-Release number of selected component (if applicable):
python3-devel-3.5.3-3.fc25.x86_64

How reproducible:
Always

Steps to Reproduce:
Build a Python package that uses %py_byte_compile, e.g. waf.

Actual results:
[...]
+ xargs -0 /usr/bin/python2 -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:]]'
  File "<string>", line 1
    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:]]
                                                                                          ^
SyntaxError: invalid syntax
+ :
[...]
+ xargs -0 /usr/bin/python3 -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:]]'
  File "<string>", line 1
    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:]]
                                                                                          ^
SyntaxError: invalid syntax
+ :
[...]

Because of that, no compiled Python files are created, neither for Python2 nor for Python3.


Expected results:
Byte-compilation

Additional info:
As a side note, the "-r" option should be added to xargs, to prevent running in case no Python files are found by the find command.

Comment 1 Tomas Orsava 2017-03-21 10:50:40 UTC
Thanks for reporting, I'll fix it right away.

Comment 2 Tomas Orsava 2017-03-21 17:17:19 UTC
Pushed and building in rawhide, bodhi updates will follow.

Comment 3 Fedora Update System 2017-03-22 08:50:54 UTC
python3-3.5.3-4.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-8e8c12076a

Comment 4 Fedora Update System 2017-03-22 08:51:01 UTC
python3-3.5.3-4.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-94efb208ee

Comment 5 Fedora Update System 2017-03-22 08:51:08 UTC
python3-3.6.0-22.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0e4be912ab

Comment 6 Fedora Update System 2017-03-22 15:29:03 UTC
python3-3.6.0-22.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-0e4be912ab

Comment 7 Fedora Update System 2017-03-22 20:22:41 UTC
python3-3.5.3-4.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-8e8c12076a

Comment 8 Fedora Update System 2017-03-22 20:56:33 UTC
python3-3.5.3-4.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-94efb208ee

Comment 9 Fedora Update System 2017-03-24 18:56:25 UTC
python3-3.5.3-4.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2017-04-01 17:25:49 UTC
python3-3.6.0-22.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2017-04-03 22:19:27 UTC
python3-3.5.3-4.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.