[Python-Dev] Dropping __init__.py requirement for subpackages
Bernhard Herzog
bh at intevation.de
Thu Apr 27 15:48:01 CEST 2006
"Gustavo Carneiro" <gjcarneiro at gmail.com> writes:
> Now the problem. Suppose you have the source package python-foo-bar,
> which installs $pythondir/foo/__init__.py and $pythondir/foo/bar.py. This
> would make a module called "foo.bar" available. Likewise, you can have the
> source package python-foo-zbr, which installs $pythondir/foo/__init__.py and
> $pythondir/foo/zbr.py. This would make a module called "foo.zbr" available.
>
> The two packages above install the file $pythondir/foo/__init__.py. If
> one of them adds some content to __init__.py, the other one will overwrite
> it. Packaging these two packages for e.g. debian would be extremely
> difficult, because no two .deb packages are allowed to intall the same file.
>
> One solution is to generate the __init__.py file with post-install hooks
> and shell scripts. Another solution would be for example to have only
> python-foo-bar install the __init__.py file, but then python-foo-zbr would
> have to depend on python-foo-bar, while they're not really related.
Yet another solution would be to put foo/__init__.py into a third
package, e.g. python-foo, on which both python-foo-bar and
python-foo-zbr depend.
Bernhard
--
Intevation GmbH http://intevation.de/
Skencil http://skencil.org/
Thuban http://thuban.intevation.org/
More information about the Python-Dev
mailing list