Le vendredi 17 juillet 2009 à 11:55 -0400, Tim Abbott a écrit :
> package: python-support
> version: 1.0.3
> 
> Consider a package foo that provides both a python module (say, foo.bar) 
> and a python program baz that imports foo.bar.  With the current 
> python-support implementation, it is not possible to run baz in the 
> package's postinst script.  What will happen is that the "import foo.bar" 
> line of baz will fail in the postinst script with
> 
> ImportError: No module named foo

From README.gz:

 Namespace packages
 ------------------
Namespace packages are empty __init__.py files that are necessary for 
other .py files to be considered as Python modules by the interpreter. 
To avoid this being a problem, python-support will add them automatically
as needed. However, this will be done later than the update-python-modules 
call when dpkg installs the package, because this is, like 
byte-compilation, a time-consuming operation.

What this means is, if you need a namespace package or depend on a 
package that needs it, *and* that you need to use it during the 
postinst phase (e.g. for a daemon), you will have to add the following 
command in the postinst before starting your daemon:
        update-python-modules -p


Cheers,
-- 
 .''`.      Josselin Mouette
: :' :
`. `'   “I recommend you to learn English in hope that you in
  `-     future understand things”  -- Jörg Schilling

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée

Reply via email to