Re: policy 2.3 para 2
On Mon, Feb 11, 2002 at 10:19:56PM +1100, Donovan Baarda wrote:
> > > Why not take the emacsen-common method and code and use this for
> > > python? It probably won't work for C-extension modules, but it could
> > > make life easier for pure Python ones.
>
> Just a thought; since we already have a database of packages in the form of
> the dpkg database, is it possible to do something simple using it instead of
> introducing some other database? As an example, can a python package call
> "dpkg-reconfigure" for all installed packages that depend on "python" in
> its postinst script?
You have two cases to consider:
(1) Installing/removing pythonX.Y package
(2) Installing/removing a python-depending package
Your suggestion will perhaps work for the former but not for the
latter: every python package which wishes to use this scheme will have
to have postinst code anyway.
It may be that as python is simpler, we can simply have a script in a
python-common package which does something like (pardon me if I get
the python a little wrong) -- this could be rewritten in python, of
course, although there's a little question of which python version
would be used....
#! /bin/sh
<Check to see whether there are any arguments saying to limit the
versions of python used or something similar>
while [ $# -gt 0]; do
for pyth in /usr/bin/python[12].[0-9]; do
cd /usr/lib/`basename $pyth`
ln -s ../python-common/$1 .
$pyth -c "import py_compile; py_compile.compile('$1');
py_compile.compile('$1','${1}o');"
done
done
and a similar one for a package removal. Then on installation, a
python-module providing package could say in its postinst:
debian-python-compile foo.py bar.py wibble.py wobble.py
and install these modules into /usr/lib/python-common.
Or alternatively, just install them all into /usr/lib/python-common
and run python-update-install, which is essentially the same as the
above but doesn't take filename arguments and does the following
instead:
for pyth in /usr/bin/python[12].[0-9]; do
cd /usr/lib/`basename $pyth`
for module in /usr/lib/python-common/*.py; do
module=`basename $module`
if [ -L $module ]; then continue; fi
ln -s ../python-common/$module .
$pyth -c "import py_compile; py_compile.compile('$module');
py_compile.compile('$module','${module}o');"
done
done
However, that doesn't handle the case of removing packages. This
could be done using dpkg as you suggest: in the prerm, call
python-update-remove $pkg, and this does the following:
for pyth in /usr/bin/python[12].[0-9]; do
cd /usr/lib/`basename $pyth`
for module in dpkg -L $pkg | grep '^/usr/lib/python-common/.*\.py$'; do
module=`basename $module`
if [ -L $module ]; then
rm -f $module ${module}c ${module}o
fi
done
done
Now that's seriously easier than the emacsen-common solution, and is
possibly adequate for this situation.
Julian
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey, Dept of Maths, Debian GNU/Linux Developer
Queen Mary, Univ. of London see http://people.debian.org/~jdg/
http://www.maths.qmul.ac.uk/~jdg/ or http://www.debian.org/
Visit http://www.thehungersite.com/ to help feed the hungry
Reply to: