[Import-SIG] PEP 420 sprint report

Eric V. Smith eric at trueblade.com
Fri May 4 18:57:28 CEST 2012


On 05/04/2012 12:50 PM, PJ Eby wrote:
> On Fri, May 4, 2012 at 11:13 AM, Eric V. Smith <eric at trueblade.com
> <mailto:eric at trueblade.com>> wrote:
> 
>     3. The zipimport finder currently looks for "path/" to detect if a
>     'directory' exists and could be a namespace portion. However, this is a
>     valid zip file:
>     Archive:  namespace_pkgs/missing_directory.zip
>      Length      Date    Time    Name
>     ---------  ---------- -----   ----
>            0  2012-05-04 04:45   bar/
>           35  2012-05-04 04:45   bar/two.py
>           26  2012-05-04 04:45   foo/one.py
>     ---------                     -------
>           61                     3 files
>     The current code will treat "bar" as a possible portion, but not "foo".
>     We discussed a number of ways to address this, but I'm unconvinced
>     they're worth the hassle and runtime expense. But in any event, it's an
>     issue for another day and doesn't affect the PEP's acceptance one way or
>     the other.
> 
> 
> FYI, the zip files produced by distutils do not include the empty
> directory.  Actually, I'm not sure when/where I've ever seen an empty
> directory listed in a zipfile.

Interesting, thanks for the info.

They are created if you use "zip -r" from a Linux box and it recurses
into the directory. But it's definitely possible to create them without
the empty directory if you explicitly list the files, or of course you
can just delete them after the fact (which is what I did here).

> IMO, the no-explicit-directory case should be handled, if for no other
> reason than that it shouldn't randomly break depending on which
> archiving tool you used to create the zipfile with.

I agree. It's just that I'm not likely to get to it in the next few
weeks. Hopefully I'll delay long enough that someone smarter than me
will rewrite zipimport in Python
(http://bugs.python.org/issue14678?@ok_message=issue 14678). I started
with Python so I wouldn't have to write any more C!

Eric.


More information about the Import-SIG mailing list