[Distutils] [setuptools] Sophisticated package requirements

Michał Kwiatkowski constant.beta at gmail.com
Mon Aug 7 02:55:31 CEST 2006


On 8/7/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 08:18 PM 8/4/2006 +0200, =?ISO-8859-2?Q?Micha=B3_Kwiatkowski?= wrote:
> >I'm using setuptools interface to fetch packages from PyPI. Version
> >requirements work fine, but more sophisticated conditions are needed.
> >In particular, I would like to hint setuptools to prefer source
> >distributions (tar/subversion/..) over eggs and prefer fetching
> >distributions from PyPI over relying on locally installed releases
> >(even if version numbers match). Currently my code looks something
> >like that:
> >
> >from setuptools.package_index import PackageIndex
> >from pkg_resources import Requirement
> >
> >pkgindex = PackageIndex()
>
> Pass an empty search path, e.g. PackageIndex(search_path=[])
>
> This will create an index that doesn't include any installed eggs.
>
>
> >path = pkgindex.fetch(Requirement.parse(REQUIREMENTS),
> >     TMP_DIR, force_scan=True)
> >
> >According to documentation, setting force_scan to False would inhibit
> >checking local filesystem,
>
> I don't know where you're getting that from.  The docstring says:
>
> """If necessary, or if the `force_scan` flag is set, the requirement is
> searched for in the (online) package index as well as the locally
> installed packages."""
>
> Note the "as well as".  Anyway, creating the PackageIndex with search_path
> set to an empty list should do what you want, except you also want to pass
> 'source=True' to 'fetch()' if you want it to find only source packages.

Works well. Thanks!

Cheers,
mk
-- 
 . o .       >>  http://joker.linuxstuff.pl  <<
 . . o   It's easier to get forgiveness for being wrong
 o o o   than forgiveness for being right.


More information about the Distutils-SIG mailing list