[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-distutils-sig
Subject:    Re: [Distutils] Optional requirements with "extra"
From:       "P.J. Eby" <pje () telecommunity ! com>
Date:       2010-08-11 14:46:08
Message-ID: 20100811144614.7FF123A4108 () sparrow ! telecommunity ! com
[Download RAW message or body]

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

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic