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

Re: pure python and postinst



On Wed, 2003-04-02 at 13:46, Matthias Urlichs wrote:
> Hi,
> 
> On Tue, 01 Apr 2003 23:20:22 +0000, Donovan Baarda wrote:
> > 2) it ties you package to the particular version of python used to
> > generate the pyc files (ie, you had better have "Depends: python2.1" if
> > the .pyc's were generated with python 2.1)
> > 
> That's not correct, as Python will ignore .pyc files with incompatible
> versions. Otherwise you couldn't run Python 2.1 on a system which defaults
> to 2.2.

AFAIK, the behaviour is to check if the pyc's are compatible, if they
are not, compile the .py's again and attempt to save the newly generated
.pyc's, failing silently if they can't be written.

This means if you run python2.2 over a bunch of software that has .pyc's
compiled by python2.1, what happens depends on if you have write
permission to those pyc's. The person doing it doesn't notice any
difference, but without write permission, you end up re-compiling the
.py's every run. If you do have write permission, the .pyc's get
"updated" to the version of python you just ran.

On a Debian system, the .pyc's are compiled when the package is
installed as root, and they are not writable by non-root users. The
packages _should_ be installing .pyc's for different versions of python
in different places... when you run python2.1 you are using a totally
different bunch of pyc's than if you run python2.2.

So when you run python2.1 on a system with a default python of 2.2, you
are not using the same pyc's... the reason it works is not just that
python is very forgiving about pyc's.

If you do force a program to run using python2.1 on a system where
python 2.2 is the default (ie, python2.1 /usr/bin/reportbug), you had
better not do it as root, otherwise you "corrupt" the pyc's and force
python to recompiled them every time you run that program using the
default python.

-- 
----------------------------------------------------------------
Donovan Baarda                http://minkirri.apana.org.au/~abo/
----------------------------------------------------------------



Reply to: