[Distutils] making eggs and debs live together peacefully

Ian Bicking ianb at colorstudy.com
Thu Jan 19 18:04:54 CET 2006

Frédéric Gobry wrote:
> 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. 

Note that it doesn't install *over* it at all.  A normal "python 
setup.py install" without setuptools and with Debian's default 
distutils.cfg *will* install over it, but with setuptools/easy_install 
it will not.

If you install multiversion (-m to easy_install) then you won't really 
have effected the system at all except for packages that specifically 
require ElementTree through setuptools mechanisms.  Altogether it is 
much lower impact than normal distutils installs.

> So, should I add some extra logic to the setup.py script (ie, try the
> dependencies myself) or is there a way to tell it "don't update the
> dependence if you can already import the module" in a convenient way?

There is a new option, added largely for Debian and other packagers, of 
python setup.py install --single-version-externally-managed.  However, 
this doesn't add the information to an already-installed package, 
instead it allows package maintainers to add that egg information 
without otherwise effecting the layout they are using for libraries.

It would almost be reasonable to add this metadata to a package that is 
already installed, except that I don't know how setuptools could figure 
out the metadata (version, distribution name) except through 
Debian-specific hooks.  Though it is not unreasonable to write the files 
by hand -- I think all you need is a directory like 
ElementTree-VERSION.egg-info/, with one or two files in it.

Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org

More information about the Distutils-SIG mailing list