[Python-Dev] Mysterious Python pyc file corruption problems (original) (raw)
David Malcolm dmalcolm at redhat.com
Fri May 17 21:38:46 CEST 2013
- Previous message: [Python-Dev] Mysterious Python pyc file corruption problems
- Next message: [Python-Dev] Mysterious Python pyc file corruption problems
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 2013-05-17 at 14:23 -0400, Barry Warsaw wrote:
On May 17, 2013, at 01:19 PM, David Malcolm wrote:
>Fedora/RH pregenerate the .pyc files during rpm creation, and they exist >as part of the rpm payload. Good to know, thanks. Do you use
$PYTHON -m pycompile
to generate the pyc files at build time?
We use compileall.compiledir() most of the time, but occasionally use py_compile.compile()
Specifically, for python 2, the core rpm-build package has a script: /usr/lib/rpm/brp-python-bytecompile run automatically in a postprocessing phase after the upstream source has installed to a DESTDIR, and this invokes compileall.compiledir() on all .py files in the package payload, with various logic to segment the different parts of the filesystem to be bytecompiled by the appropriate python binary (since we have duplicate .py files for different python runtimes). This is all done sequentially, so I'd be surprised if different pythons splatted on each other's .pyc files at this time.
In addition, python3-devel contains a: /etc/rpm/macros.pybytecompile which defines a py_byte_compile() macro, which can be used for overriding these rules (IIRC), and this does use pycompile.compile()
Hope this is helpful Dave
- Previous message: [Python-Dev] Mysterious Python pyc file corruption problems
- Next message: [Python-Dev] Mysterious Python pyc file corruption problems
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]