[Distutils] making eggs and debs live together peacefully

Phillip J. Eby pje at telecommunity.com
Thu Jan 19 18:45:57 CET 2006


At 02:11 PM 01/19/2006 +0100, Frédéric Gobry wrote:
>Hi,
>
>I've started using setuptools as a developer quite recently, and
>appreciate the extra features. I've a question though, regarding the way
>dependencies are resolved when installing such a package: I've written a
>package that uses elementtree, and would have found natural to add it in
>install_requires. However, I've already installed it as a debian
>package, and in the current state setuptools tries to reinstall over it.

On Debian-based systems, you should add these lines to ~/.pydistutils.cfg 
if you want to install eggs system-wide (substituting python2.4 if 
appropriate):

[install]
prefix=/usr/local

[easy_install]
site_dirs=/usr/local/lib/python2.3/site-packages

This will ensure that easy_install does *not* try to overwrite system 
packages, although it may duplicate them in the interim.  For more 
information, please see the "Custom Installation Locations" section of the 
EasyInstall wiki page, which describes other ways of customizing where and 
how packages are installed.

This will of course duplicate system packages that do not carry egg 
metadata.  If you want to make it possible to use the Debian-installed 
packages without duplication, you can do this by installing .egg-info files 
with the same base filename as the egg they would represent, placed in the 
site-packages directory where the package is installed.  So, you might have 
something like "elementtree-1.0.2-py2.3.egg-info" in site-packages.  The 
file's contents should be the package's PKG-INFO as created by the 
distutils.  The setuptools runtime will find these files and thus know that 
it can access those packages as long as 'site-packages' is listed in sys.path.



More information about the Distutils-SIG mailing list