[Distutils] nspkg.pth files break $PYTHONPATH overrides
pje at telecommunity.com
Tue Mar 25 21:30:56 CET 2014
On Tue, Mar 25, 2014 at 3:50 PM, Barry Warsaw <barry at python.org> wrote:
> On Mar 25, 2014, at 03:35 PM, PJ Eby wrote:
> >I think the correct fix would be to change the nspkg.pth magic to check
> >PEP 420 support, but unfortunately it seems we may have to use version
> >checking: on rereading PEP 420 I see there's no 'sys.namespace_packages'
> >similar object that can be directly checked for feature support. :-(
> 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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Distutils-SIG