At 01:01 PM 4/23/2008 -0600, Michael Hearne wrote:
>Phillip - Thanks for the quick response. One feature suggestion for
>the future:
>
> From my perhaps naive perspective, it seems like it would be easy to
>add non-PyPI dependencies that the installer could complain about.
>For example, if the setup() function accepted a keyword list that
>contained just the name of the package (whatever you use to import
>it), and then have the installer do something like this:
>
>deps = ['foo','bar'] (this is the keyword list passed to the setup
>function)
>notfound = []
>for dep in deps:
> try:
> __import__(dep)
> except:
> notfound.append(dep)
> if notfound:
> print 'The following required packages are not
> installed. Exiting.'
>% (str(notfound))
> sys.exit(1)
I don't think this is a significant enough improvement over the
package aborting at runtime, to add the complexity. Plus, it removes
the incentive for the depender to lobby the dependee to make their
package easy_install-able. :)
(And, it's actually more complex if you're trying to do version
detection as well as presence detection. There's some old code in
setuptools.depends that tries to do this sort of thing, but I
abandoned that approach many years ago.)