[Patches] [ python-Patches-645650 ] Import from Zip Archive

noreply@sourceforge.net noreply@sourceforge.net
Fri, 29 Nov 2002 13:11:12 -0800


Patches item #645650, was opened at 2002-11-29 11:37
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=645650&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Paul Moore (pmoore)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Import from Zip Archive

Initial Comment:
This patch supersedes patch 492105.

This is an updated version of the patch for imports from 
a zip file. This version is against current CVS, and 
includes documentation and tests.

The patch builds on Windows, and runs OK. I haven't 
(yet) run any comprehensive tests, as this is the first 
time I've set up a build environment, and I'm not sure 
how to run the tests yet :-(

----------------------------------------------------------------------

>Comment By: Paul Moore (pmoore)
Date: 2002-11-29 21:11

Message:
Logged In: YES 
user_id=113328

My problem turns out to be an interaction with the 
new "universal newline support". In find_module, within the 
switch(path_type), case PY_IMP_LISTDIR, the section of 
code marked /* Search the list of suffixes: .pyc, .pyd, ... */ 
tries to do fopen(buf, fdp->mode). But .py files are now 
mode 'U' (universal newline) which is not a valid mode for fopen
(). I've made a fix, but I'm not sure how reliable it is.

On a related note, I'm not 100% sure how robust the code is 
in the presence of case-insensitive filesystems. I'm way out of 
my depth in this code, so I don't know if I'll be able to fix it, 
but I'll have a look (and I'll look at your version of the patch, as 
well).

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-29 18:47

Message:
Logged In: YES 
user_id=33168

Paul, thanks for taking this up.  I made very little
progress on this  I have attached my version of the diffs.

I had some problems with the original patch which I was
never able to correct.  For example, I think it was not
possible to run python from a local build env't.  It
appeared that python had to be installed for everything to
work.  See the problem in bug 586680 (also in site.py). 
That should probably be addressed and was part of my problem.

I tried to simplify the code some, so you should see some
differences between the patch I attached and the original. 
These are not as important as making the patch work
properly, both when installed and running from a build env't.

I will try to take a look at your problem later, but it may
take a while.  Let me know if you make progress.

----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2002-11-29 11:57

Message:
Logged In: YES 
user_id=113328

Bad news. I've just hit problems with the patched Python - 
when I start python.exe, it reports "cannot import site" and 
seems unable to locate the standard library. (This when I run 
python from the PCBuild directory).

I built a clean CVS version, and don't see this problem.

Can anyone else reproduce this, or help me diagnose it? I 
don't understand Jim's changes well enough to see what 
might be the problem (I updated the patch purely 
mechanically).

----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2002-11-29 11:40

Message:
Logged In: YES 
user_id=113328

Uploaded file foo.zip, needed (in lib\test directory) for the 
changes to test_import.py

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=645650&group_id=5470