Bug 787498

Summary: not all files properly byte compiled
Product: [Fedora] Fedora Reporter: Thomas Spura <tomspur>
Component: python3Assignee: Thomas Spura <tomspur>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: amcnabb, dmalcolm, tomspur, watzkej
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-19 14:52:46 UTC Type: ---
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 Spura 2012-02-05 19:31:04 UTC
Description of problem:
Most *.py files are newer than the compiled *.pyc files, so at runtime python3 tries to recompile them:

$ python3 -v
[snip]
Python 3.2.1 (default, Jul 11 2011, 18:54:42) 
[GCC 4.6.1 20110627 (Red Hat 4.6.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
[snip]
>>> import chunk
# /usr/lib64/python3.2/__pycache__/chunk.cpython-32.pyc has bad mtime
import chunk # from /usr/lib64/python3.2/chunk.py
# can't create /usr/lib64/python3.2/__pycache__/chunk.cpython-32.pyc

This is because there is no ./python when trying to recompile everything in the spec file.

Use the newly installed python instead fixes it.

Comment 1 Fedora Update System 2012-02-05 20:58:07 UTC
python3-3.2.1-3.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/python3-3.2.1-3.fc16

Comment 2 John Watzke 2012-02-06 05:20:30 UTC
I installed this package and tried to run the test steps as a regular user.  When I try to import chunk, I still get the error that the file cannot be created.  I then ran it as root which compiled it correctly.

Still, I can "import pickle" and find modules that are not compiled.

>>> import pickle
# /usr/lib/python3.2/__pycache__/pickle.cpython-32.pyc has bad mtime
import pickle # from /usr/lib/python3.2/pickle.py
# can't create /usr/lib/python3.2/__pycache__/pickle.cpython-32.pyc
# /usr/lib/python3.2/__pycache__/types.cpython-32.pyc has bad mtime
import types # from /usr/lib/python3.2/types.py
# can't create /usr/lib/python3.2/__pycache__/types.cpython-32.pyc
import marshal # builtin
# /usr/lib/python3.2/__pycache__/struct.cpython-32.pyc has bad mtime
import struct # from /usr/lib/python3.2/struct.py
# can't create /usr/lib/python3.2/__pycache__/struct.cpython-32.pyc
dlopen("/usr/lib/python3.2/lib-dynload/_struct.cpython-32mu.so", 2);
import _struct # dynamically loaded from /usr/lib/python3.2/lib-dynload/_struct.cpython-32mu.so
# /usr/lib/python3.2/__pycache__/_compat_pickle.cpython-32.pyc has bad mtime
import _compat_pickle # from /usr/lib/python3.2/_compat_pickle.py
# can't create /usr/lib/python3.2/__pycache__/_compat_pickle.cpython-32.pyc
dlopen("/usr/lib/python3.2/lib-dynload/_pickle.cpython-32mu.so", 2);
import _pickle # dynamically loaded from /usr/lib/python3.2/lib-dynload/_pickle.cpython-32mu.so

Comment 3 Thomas Spura 2012-02-06 09:23:08 UTC
From building:
Bytecompiling .py files below /builddir/build/BUILDROOT/python3-3.2.1-3.fc16.x86_64/usr/lib/python3.2/ using /usr/bin/python3.2
/usr/lib/rpm/brp-python-bytecompile: line 44: /usr/bin/python3.2: No such file or directory
/usr/lib/rpm/brp-python-bytecompile: line 51: /usr/bin/python3.2: No such file or directory
Bytecompiling .py files below /builddir/build/BUILDROOT/python3-3.2.1-3.fc16.x86_64/usr/lib64/python3.2/ using /usr/bin/python3.2
/usr/lib/rpm/brp-python-bytecompile: line 44: /usr/bin/python3.2: No such file or directory
/usr/lib/rpm/brp-python-bytecompile: line 51: /usr/bin/python3.2: No such file or directory

So I don't see another possibility than reinventing the brp-python-bytecompile wheel in the spec file...

Comment 4 Fedora Update System 2012-02-10 21:59:17 UTC
Package python3-3.2.1-4.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python3-3.2.1-4.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-1538/python3-3.2.1-4.fc16
then log in and leave karma (feedback).

Comment 5 Andrew McNabb 2012-02-16 03:26:42 UTC
(In reply to comment #3)
> 
> So I don't see another possibility than reinventing the brp-python-bytecompile
> wheel in the spec file...

It looks to me like brp-python-bytecompile is broken. The script defines two environment variables: default_python and python_binary. The default_python variable respects the argument passed in as $1, but python_binary throws it out. It seems to me that if an argument is passed in, it should be used everywhere.

Perhaps the definition of python_binary should be:

python_binary="${1:-/usr/bin/$(basename $python_libdir)}"

where it is currently:

python_binary=/usr/bin/$(basename $python_libdir)

Comment 6 Fedora Update System 2012-04-12 17:18:07 UTC
python3-3.2.3-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/python3-3.2.3-1.fc16

Comment 7 Fedora Update System 2012-06-08 06:12:09 UTC
python3-3.2.3-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/python3-3.2.3-2.fc16

Comment 8 Fedora Update System 2012-06-19 14:52:46 UTC
python3-3.2.3-2.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.