[Distutils] Optional requirements with "extra"

P.J. Eby pje at telecommunity.com
Wed Aug 11 16:46:08 CEST 2010


At 02:57 PM 8/11/2010 +0200, Mathieu Leduc-Hamel wrote:
>If you install the package with the satchmo support like that:
>
>storelocator[satchmo]
>
>Then I would like be able with pkg_resources or something like to 
>check in the code if the satchmo support has been enabled or not, if 
>yes, i'll change some part of my package or not.

try:
    pkg_resources.require('storelocator[satchmo]')
except pkg_resources.ResolutionError:
    pass  # failure case
else:
    pass  # success case



More information about the Distutils-SIG mailing list