On Tue, Mar 25, 2014 at 2:30 PM, PJ Eby <p...@telecommunity.com> wrote:
> On Tue, Mar 25, 2014 at 3:50 PM, Barry Warsaw <ba...@python.org> wrote:
>> There is.  It's *pronounced* sys.namespace_packages, but it's spelled
>> importlib._bootstrap._NamespaceLoader ;)
>
>
> Yeah, well that's not exactly a public attribute, so it's not necessarily a
> great way to do it.  But if we did use that, presumably it'd add something
> like:
>
>     hnp =
> hasattr(sys.modules.get('importlib._bootstrap',None),'_NamespaceLoader');

In 3.4 it's called _NamespaceLoader, but in 3.3 it's NamespaceLoader. <ducks>

>
> To the front of the magic, and then prefix all subsequent expression values
> with 'not hnp and' in order to prevent them executing if PEP 420 support is
> available. (Note: it's checking sys.modules since on any interpreter where
> PEP 420 is natively available, the module should *already* be loaded by the
> time site.py does its thing.)
>
> And we should probably think about adding sys.namespace_packages or
> something of the sort, or at least a proper flag for whether PEP 420 support
> is available on the platform.

By "available on the platform" do you mean "Python 3.3+ or has a
backport installed"?  Otherwise you'd just check sys.version*.

-eric
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to