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

Re: Help needed with #159208



On Thu, Sep 05, 2002 at 07:48:38AM -0500, Dirk Eddelbuettel wrote:
> 
> 
> > You should depend on exactly the Python versions you support, not on
> > "python". For example
> > Depends: python1.5 | python2.1 | python2.2
> 
> I see. But why not simply   "Depends: python (>= 1.5)"

I think this is wrong. If this is a package with python scripts, then they
will probably have '#!/usr/bin/python', in which case the dependancy should
be;

Depends: python (>=1.5), python (<<2.3)

You could make a package of scripts that could work with "python1.5 |
python2.1 | python2.2", but it would either require seperate foo-python1.5,
foo-python2.1, and foo-python2.2 scripts, or some sort of smart dispatcher
that could find and run the right installed /usr/bin/pythonX.Y.

Remember, /usr/bin/python is a symlink installed by the "python" package,
and without a dependancy on this package there is no gaurentee that it will
be there. You can't just use "#!/usr/bin/python" without depending on the
"python" package.

>  
> > And if you dont compile any Python packages, why do you still have to
> > build-depend on python-dev?
> 
> Quite right, good point -- thanks.

I _think_ you are saying that this package used to include compiled
"*.py[oc]" files and now it doesn't. That is good.

However, if it still includes *.py modules that are "imported", then you
still need to be very careful. Python will create and save "*.pyc" files
when these modules are imported. However, typicaly only root has write
access to the directories where these *.py files are installed. This means
these *.pyc files are only created when root runs the scripts that import
them.

Worse, if the default python is upgraded, then the old *.pyc files cannot by
"updated" by python, and hang around until root happens to "import" them
again.

I'm pretty sure python silently doesn't save *.pyc files if it can't, making
them be re-compiled every "import". It also re-compiles them if the *.pyc's
are from a different version of python. This means worst case, python
silently checks existing *.pyc's, recompiles them, then throws them away for
every run.

The proper way of handling this is for the postinst scripts to compile the
*.pyc modules, and the postinst script to remove them. The really complicated 
stuff starts to happen when these script+module packages support multiple
versions of python... If you need more info on this just ask.


-- 
----------------------------------------------------------------------
ABO: finger abo@minkirri.apana.org.au for more info, including pgp key
----------------------------------------------------------------------



Reply to: