[Distutils] Skipping namespace file?
Phillip J. Eby
pje at telecommunity.com
Thu Jan 4 22:42:59 CET 2007
At 10:47 AM 1/3/2007 -0500, Kurt Schwehr wrote:
>I am working on packaging pydap and am getting some strange behavior.
>Here is the install phase...
>/sw/bin/python2.4 setup.py install
>And when it gets to the __init__.py file for dap, it skips it. This
>causes the package to not work.
It should also be installing a .pth file that makes it work, but if your
final installation destination is not a 'site' directory (e.g. Python's
site-packages directory), this will not work.
> Anyone have an idea why it is doing this?
Because system packaging tools like RPM et al do not like it when multiple
packages install the same file. dap.plugins and dap.responses are
"namespace packages", which means that other projects can install modules
in them. Those modules mustn't install an __init__.py, as it would
overwrite the one supplied by pydap. The setuptools solution to this
problem is to never install an __init__.py at all for such packages, when
used with a packaging tool (which is implied by the use of --root).
Instead, setuptools generates a uniquely-named .pth file for each project,
that sets up the namespace package at runtime. Look for a .pth file being
placed in your
directory. The problem is that if you then install the package somewhere
other than /sw/lib/python2.4/site-packages, or use the -S option to Python
at runtime, it may not work.
>This install proceedure works well with other packages in mac osx/fink. I
>also see the behavior without the --single-version-externally-managed flag.
That's because --root implies --single-version-externally-managed.
More information about the Distutils-SIG