Bug 1749040

Summary: manual python byte compilation is broken
Product: [Fedora] Fedora EPEL Reporter: Carl George 🤠 <carlwgeorge>
Component: python-rpm-macrosAssignee: Miro Hrončok <mhroncok>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: cstratak, j, m.cyprian, mhroncok, orion, pviktori, python-sig
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: 2020-02-04 14:57: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 Carl George 🤠 2019-09-04 18:25:01 UTC
Description of problem:
The packaging guidelines say that manual python byte compilation is possible in EPEL.

https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_manual_byte_compilation_for_fedora_29_or_earlier_including_epel

However, it doesn't work on EL6.

https://src.fedoraproject.org/rpms/python-rpm-macros/blob/el6/f/macros.pybytecompile#_24

python_version=$(%1 -c "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))") \

$ python -c "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'major'

sys.version_info.{major,minor} doesn't exist in EL6's Python.  This is similar to bug 1369486.

Version-Release number of selected component (if applicable):
python-rpm-macros-3-14.el6.noarch

How reproducible:
always

Comment 1 Miro Hrončok 2019-09-04 18:50:02 UTC
This should do: '{0[0]}{0[1]}'.format(sys.version_info)

However not sure if the remaining part of %py_byte_compile works with 2.6 or not. Could you test?

Comment 2 Petr Viktorin (pviktori) 2020-02-04 14:57:25 UTC
Please reopen if you have an answer.

Comment 3 Carl George 🤠 2020-02-09 16:13:12 UTC
Sorry I never got around to testing this.  I'm clearing the needsinfo because I don't intend to come back around to this before the EL6 end of life.