[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Compiled pyton files for all arch?



Mikael Hedin <mikael.hedin@irf.se> writes:
> The python tutorial says .pyc are arch independent, but when I
> compared the .pyc from the i386 and powerpc debs, there were some
> small differences. E.g. there is a string with the arch, and then a
> few differing bits in the end and beginning.  Are these just som
> note about the compilation environment/time etc.?

In practice, I think (but have no actual proof) that the interpreter
will try to recompile them if they were made on a different
architecture... but if it does, you won't notice anything but slower
loading times.  As far as I am aware, pyc/pyo objects are not
guaranteed to be compatible with anything in particular -- they are
really just a cache for the Python interpreter's private use, and
their format has changed on at least one occasion.  Thus, it probably
isn't a good idea to distribute them as long as we actually have the
original source files they are made from.

Most (all?) other packages with Python code in them include only the
source, and will compile the pyc/pyo files in the postinst script.  I
would suggest that you look at some of them to see how this is done;
you can just copy the appropriate snippet from the postinst and prerm
of one of them.

If your package contains only Python code, you can then safely make it
Architecture: any.

--Rob

-- 
Rob Tillotson  N9MTB  <robt@debian.org>



Reply to: