On 2009-11-03 18:29 PM, Robert Bradshaw wrote:
> On Nov 3, 2009, at 4:13 PM, David Cournapeau wrote:
>
>> On Wed, Nov 4, 2009 at 3:27 AM, Robert Bradshaw
>> <[email protected]>  wrote:
>>
>>>
>>> How would you know, in general, that setuptools has not previously
>>> been imported?
>>
>> The reason for this line is precisely to detect whether setuptools has
>> been previously imported or not.
>
> Yes, I understand that. I should have been more clear--what makes me
> wary is that you are departing from normal behavior if, anywhere in
> the interpreters past history, a certain module has been imported.
>
> Now maybe (probably) I'm missing something here, does "import
> setuptools" in your setupegg.py do something more than just pass a
> flag to setup.py? If so, I'd really like to understand the magic.

Importing setuptools automatically monkeypatches a couple of things in 
distutils 
and activates setuptools' features. The "if 'setuptools' in sys.modules:" check 
is the safest way to optionally provide those extra setup() options only when 
the person installing the package explicitly uses easy_install or setupegg.py.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to