Robert Bradshaw, 03.11.2009 19:27: > On Nov 3, 2009, at 3:12 AM, David Cournapeau wrote: > >> On Tue, Nov 3, 2009 at 2:35 PM, Robert Bradshaw >> <[email protected]> wrote: >> >>> if 'setuptools' in sys.modules >>> >>> is this always safe? >> What kind of unsafe behavior would you have in mind ? > > How would you know, in general, that setuptools has not previously > been imported?
If it has been imported (or any of its submodules), it will appear in sys.modules, unless someone deliberately removed it from there after the import. So I'd say it's safe to test for it being in sys.modules to figure out if it's being used in a setup.py script or not. Note, however, that there's also the "distribute" package, which is mostly setuptools compatible, minus a couple of its bugs and quirks. http://pypi.python.org/pypi/distribute If we special case setuptools, we might want to support that, too - although I'm not sure how far this special casing business should go. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
