Packaging .py files

wrobell wrobell at pld-linux.org
Mon Aug 18 01:00:26 CEST 2008


On Thu, Jul 17, 2008 at 04:50:24PM +0200, Mariusz Mazur wrote:
[...]
> "If a package provides any binary-independent modules (foo.py files), the 
> corresponding bytecompiled modules (foo.pyc files) and optimized modules 
> (foo.pyo files) must not ship in the package. Instead, they should be 
> generated in the package's postinst, and removed in the package's prerm. The 
> package's prerm has to make sure that both foo.pyc and foo.pyo are removed."
> 
> This obviously makes installation a bit slower, but has the advantage of being 
> python-version independent, meaning when you upgrade python, you don't have 
> to rebuild all python-dependant packages and reinstall them -- postinst 
> scripts just rebuild *.py{c,o} files on your system and you're done.

well, basically format of bytecode files doesn't change between minor
python versions (i.e. 2.5, 2.5.1, 2.5.2...). it changes for major releases,
i.e. 2.5 -> 2.6. but then, still you have to recompile all the packages
because of directory hierarchy change

    /usr/{lib,share}/python2.5 -> /usr/{lib,share}/python2.6

[...]

    wrobell <wrobell at pld-linux.org>


More information about the pld-devel-en mailing list