[Distutils] Pre-pre-PEP: Requirements for the Python BUILDS Specification

Josselin Mouette joss at debian.org
Tue Oct 7 17:11:19 CEST 2008

Le mardi 07 octobre 2008 à 10:02 -0400, Jean-Paul Calderone a écrit :
> The expectations of the Nevow developers was that a file included in Nevow,
> nevow_widget.py, would be installed to
>   /usr/lib/python2.5/site-packages/twisted/plugins/nevow_widget.py

This expectation is wrong. You’re shipping it as a Python module, the
only thing you can expect is to be able to import it.

This wouldn’t happen if you were shipping plugins in a specific,
private, plugins directory.

> The ideal fix, from my perspective as a Twisted developer, is to install
> the nevow_widget.py file into
>   /usr/lib/python2.5/site-packages/twisted/plugins/

As explained on the debian-python list (see
http://lists.debian.org/debian-python/2008/05/msg00032.html), there are
strong reasons for not putting managed modules in the same directory as
modules included in the Python distribution. So you can’t expect modules
to be in a specific directory (but this shouldn’t be a problem since
these are not modules, hmmm?).

(I have some ideas for keeping all files at the same place and moving
only .pyc files to /var, but it requires patching the interpreter and
the Debian Python maintainer disagrees, so we’ll have to stick to the
current situation for now.)

> along with all the other Twisted plugin files (perhaps using a symlink, I
> can't think of any reason why that would make a difference, particularly
> since all the other .py files in that area are symlinks).
> In other words, Debian took advantage of a feature which was intended to be
> used only as a convenience for development and was never intended to assist
> installation.

The fact that we use a .pth to specify the different module hierarchy is
an implementation detail but is indeed abusing this feature; we should
be shipping a modified setup.py instead.

However this has nothing to do with the inability of Twisted to cope
with multiple module paths. Let’s take another example that is not
Debian specific: what if I want to install a plugin to /usr/local? The
fact that you are abusing the python modules directory forces me to
install it to /usr/local/python2.5/site-packages/twisted/plugins instead
of e.g. /usr/local/share/twisted/plugins, where a normal application or
library would be looking for its plugins. And there, I have to deal with
namespaces and other python module specificities that should be
irrelevant for plugins.

In the beginning, Debian only expected the Python modules directory to
contain, well, Python modules. It seems even that is too much to expect,
since module developers are taking advantage of a set of features
(module file location) that were initially meant for introspection.

> Have I succeeded in explaining why the Twisted plugin system isn't making
> any unusual requirements of the installation system nor using the Python
> module system in an unusual way?

Not really. You have succeeded in explaining what is the exact nature of
the unusual requirements you make, though. Thanks for that, as it is
much clearer than the original explanations I received.

> Can I expect to see any improvements to the Debian packaging of Twisted and
> projects which supply plugins to Twisted? :)

Until you fix your plugin system, we are bound to treat Twisted packages
as a special case.

: :' :      We are debian.org. Lower your prices, surrender your code.
`. `'       We will add your hardware and software distinctiveness to
  `-        our own. Resistance is futile.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message num?riquement sign?e
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20081007/c615bc4e/attachment-0001.pgp>

More information about the Distutils-SIG mailing list