Dave Malcolm <dmalc...@redhat.com> added the comment:

As a post-processing step, rpmbuild will attempt to byte-compile any .py files 
it encounters, and the results must be listed in the %files manifest. [1]

This is done by the script brp-python-bytecompile, which uses the compileall 
module.  However, my guess is that it's not using the correct version of python 
when invoking "compileall", which would explain why it's using the pre-PEP3147 
location for the .pyc/.pyo files.

Can you run "file" on the .pyc files and confirm which version of Python 
they're bytecode for?  My guess is that it's bytecompiled them with 
/usr/bin/python, rather than your local build of python.

Some notes: In older versions of RPM, brp-python-bytecompile took a single 
optional argument: the python interpreter to use, defaulting to 
/usr/bin/python.  I generalized this to support multiple defaults when adding 
Python 3 support to Fedora: see 
https://bugzilla.redhat.com/show_bug.cgi?id=531117  That patch could be 
generalized to support /usr/local/lib.

[1] In Fedora we do this using "__os_install_post", which is defined
in /usr/lib/rpm/redhat/macros (from the redhat-rpm-config package),
which has the invocation of /usr/lib/rpm/brp-python-bytecompile   So it could 
be possible to override the python interpreter to use by redefining 
__os_install_post

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to