[issue26344] `sys.meta_path` Skipped for Packages with Non-Standard Suffixed `__init__` Files

2016-02-12 Thread Wolfgang Richter

Wolfgang Richter added the comment:

Ah, sorry Brett!

Thanks for spotting this.

The import machinery is *really* awesome.

--

___
Python tracker 
<http://bugs.python.org/issue26344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26344] `sys.meta_path` Skipped for Packages with Non-Standard Suffixed `__init__` Files

2016-02-11 Thread Wolfgang Richter

Changes by Wolfgang Richter :


--
versions: +Python 3.5

___
Python tracker 
<http://bugs.python.org/issue26344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26344] `sys.meta_path` Skipped for Packages with Non-Standard Suffixed `__init__` Files

2016-02-11 Thread Wolfgang Richter

Wolfgang Richter added the comment:

Here's the file, before I experimented with find_loader.

If you take out all my print's, it's quite short.

--
Added file: http://bugs.python.org/file41905/main.py

___
Python tracker 
<http://bugs.python.org/issue26344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26344] `sys.meta_path` Skipped for Packages with Non-Standard Suffixed `__init__` Files

2016-02-11 Thread Wolfgang Richter

Wolfgang Richter added the comment:

Sure Brett I'll upload the code separately in an hour or two.

I've overridden all the publicly exposed functions (including find_spec).

I wanted to initially see if anything was passing through my finder in the 
first position of the meta_path.

--

___
Python tracker 
<http://bugs.python.org/issue26344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26344] `sys.meta_path` Skipped for Packages with Non-Standard Suffixed `__init__` Files

2016-02-11 Thread Wolfgang Richter

Wolfgang Richter added the comment:

Brett thanks for the very quick response.

I've inserted my finder as the first element in sys.meta_path.

I also overrode the @classmethod find_loader, but it doesn't appear that it's 
being called.

--

___
Python tracker 
<http://bugs.python.org/issue26344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26344] `sys.meta_path` Skipped for Packages with Non-Standard Suffixed `__init__` Files

2016-02-11 Thread Wolfgang Richter

New submission from Wolfgang Richter:

My understanding of `sys.meta_path` is that it is supposed to allow customized 
loading of Python modules and packages.

In fact the `importlib` machinery appears to have support for identifying 
packages with `__init__` files with non-standard suffixes:

https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap_external.py#L645

https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap_external.py#L1233

However, I find that when I `import wolftest` inside a folder with structure:

./
/wolftest
/__init__.wolf
/something.wolf

None of my sys.meta_path finders are called at all, and instead a namespace is 
returned.

I was wondering why the `import` statement appears to short-circuit and not 
check with `sys.meta_path` handlers in this case?

--
components: Library (Lib)
files: PyMetaPath.tar.gz
messages: 260138
nosy: Wolfgang Richter
priority: normal
severity: normal
status: open
title: `sys.meta_path` Skipped for Packages with Non-Standard Suffixed 
`__init__` Files
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file41902/PyMetaPath.tar.gz

___
Python tracker 
<http://bugs.python.org/issue26344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com