[Distutils] Finding dependencies and Limiting download

Phillip J. Eby pje at telecommunity.com
Wed Mar 15 17:30:20 CET 2006

At 03:55 PM 3/15/2006 +0200, Juha Tuomala wrote:
>Hash: SHA1
>I'm new with setuptools and probably asking wrong questions. :-)
>I'm making RPM package from python-paste for CentOS
>Linux installation and came across some problems.
>I do the installation with:
>   setup.py install --root $RPM_BUILD_ROOT

Use "setup.py bdist_rpm" to build an RPM, and all of the details (except 
RPM-level dependencies) will be handled automatically.

>and it seems to work pretty well, but it doesn't find
>my already installed cheetah package below site-pacakges
>and thus starts searching it from the net.

That's because you're using 'install' rather than 'bdist_rpm'.  If for some 
reason you can't use bdist_rpm, you should use the 
--single-version-externally-managed option to the 'install' command, which 
tells easy_install that you're building a system package, so it won't try 
to do dependencies and it won't build an egg file or directory.  Instead, 
it will install packages in the "traditional" way, with the addition of a 
.egg-info/ directory that contains the package's metadata so it will still 
work correctly at runtime.

>  Does the
>dependencies have to be installed as an egg so
>that setuptools could find them?

Yes, if the package uses the pkg_resources module at runtime to access the 
dependencies.  At minimum, the dependencies would then need .egg-info files 
or directories to indicate what is installed.  If you use setuptools to 
build new RPMs for those dependencies, you'll get that info added to the 
RPMs automatically.

>Second thing is that how do I limit the download using
>'install' ? With 'easy_install' I could use --allow-hosts=None
>or -H, but is it so that it's not available for 'install'?

If you want to get the full set of easy_install features, just go to the 
setup directory and run "easy_install .", it will install the package 
that's in the current directory, and thus you can use all the normal 
easy_install options.

Note also that if you use 'bdist_rpm', or 'install 
--single-version-externally-managed', no dependencies will be sought or 
installed at build time.  (But this doesn't stop you from needing .egg-info 
metadata for the dependencies if the installed packages are queried at 

More information about the Distutils-SIG mailing list