[Distutils] Overiding the site-packages/<module> directory name?

Phillip J. Eby pje at telecommunity.com
Mon Nov 21 23:20:54 CET 2005

At 04:11 PM 11/21/2005 -0600, Bob Tanner wrote:
>Is there a way to override the site-packages/<module> directory name?
>I'm trying to make a debian package for FormEncode-0.4, by default
>"/usr/bin/python2.4 setup.py install  --no-compile -O0" creates a directory
>structure llike:
>`-- usr
>     |-- lib
>     |   `-- python2.4
>     |       `-- site-packages
>     |           `-- FormEncode-0.4-py2.4.egg
>     |               |-- EGG-INFO
>     |               `-- formencode
>     |                   |-- javascript
>     |                   `-- util
>Reading python-policy 1.4, I believe a 3rd party module should be just
>         /usr/lib/python<X>.<Y>/site-packages/<module-dir>
>I would like to see
>`-- usr
>     |-- lib
>     |   `-- python2.4
>     |       `-- site-packages
>     |           `-- formencode
>     |               |-- javascript
>     |               `-- util
>I'm working around the "problem" by installing a formencode.pth pointing to
>the /usr/lib/python2.4/site-packages/FormEncode-0.4-py2.4.egg directory.

This isn't a "problem", it's just that the Debian policy isn't 
up-to-date.  Python eggs install this way, and many packages (e.g. 
TurboGears) require the new structure.

>I've played around with FormEncode's setup.py and the site-packages path 
>to be based on the setup(name=xxx, version=yyy), but I could not see any way
>to change these values without really messing up all the other tools that
>depend on these values.

Or all the tools that depend on the directory containing version 
information, and expect a certain layout within that directory 
structure.  Do not attempt to change .egg layouts, as any package that has 
bothered to make itself be laid out this way almost certainly has 
non-trivial dependencies on it being laid out this way.

Note also that in many cases, the package will be a single .egg *file*, 
(analagous to a Java .jar file) rather than a directory, and files are 
preferable to directories in most cases as they make Python import 
processing faster.

More information about the Distutils-SIG mailing list