The recent redhat-rpm-config change and you

Nalin Dahyabhai nalin at redhat.com
Fri Jun 17 20:52:10 UTC 2005


As you've probably noticed [1], redhat-rpm-config-8.0.35 and later have
started using the brp-python-bytecompile script to byte-compile python
scripts at the end of %install.

What does this mean for your package?

If your package specifies a buildroot, after the %install phase
completes, rpmbuild will now find .pyc and .pyo files sitting alongside
any .py files which were installed under $RPM_BUILD_ROOT.

If your package's %files list doesn't mention these files, you'll need
to update it to get the package to build successfully without tripping
the unpackaged-files-in-buildroot sanity check.  The procedure is
similar to what we all needed to do when we started compressing man
pages by default, tedious but simple: either change every instance of
".py" to ".py*", or add the .pyc and .pyo files to the %files list
individually.

If your package was explicitly byte-compiling modules in the %install
scriptlet, you can now, at your option, stop it from doing so.

If your package uses distutils to build an RPM (specifically, if it
calls "python setup.py install" with the "--record" option to generate
its %files list), then you'll need to add the "-O1" flag to the command
to get a correct list.

Yes, this makes the packages larger.  How much larger is entirely
dependent on how much python code the package contains. [2]

HTH,

Nalin

[1] http://www.redhat.com/archives/fedora-devel-list/2005-June/msg01043.html
[2] You can filter the "rpm -qlv" output through
    awk 'BEGIN{size=1;pyosize=0;pycsize=0;pysize=0}/\.py$/{pysize=pysize+$5}/\.pyc$/{pycsize=pycsize+$5}/\.pyo$/{pyosize=pyosize+$5}{size=size+$5}END{printf ".py:%7.2f%%\n",pysize*100/size;printf ".pyc:%6.2f%%\n",pycsize*100/size;printf ".pyo:%6.2f%%\n",pyosize*100/size}'
    to get a breakdown of how much space python files take up in a package.




More information about the Fedora-maintainers mailing list