[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Distutils] formencode as .egg in Debian ??



Phillip J. Eby wrote:
If you have many zipfiles on sys.path, all applications will suffer
from having to read the TOC of all those zipfiles, even if they need
none of them. OTOH, if you had packages inside site-python, the
contents of the unused packages is simply ignored.


I'm sorry, but this is, shall we say, "fact challenged"? .pth files' contents are added to the *end* of sys.path. This means that stdlib imports and normal site-packages imports are satisfied *before* any hypothetical overhead from .pth entries, whether they're zipfiles or directories.

Correct. I was not talking about stdlib imports. I was talking about imports satisfied from the end of sys.path, or imports resulting in
ImportErrors.

If Python never reaches the .pth entries at runtime, it will not even read the zipfile TOCs, let alone attempting to stat() for contained packages.

Correct. However, a false preposition can imply anything: Python
*always* reaches the .pth entries atleast once, in a typical
installation, while looking for sitecustomize. This will cause
a load of all zipfiles on sys.path, before site.py is done.

Please check your facts before spreading untruths like this

I did check: I have a file a.pth in site-packages, which refers to
a.zip (in the same directory), and I have an empty Python file e.py.
Running

strace -o xxx python e.py

shows, among others

open("/usr/lib/python2.3/site-packages/a.zip", O_RDONLY|O_LARGEFILE) = 5
...
ead(5, "PK\3\4\n\0\0\0\0\0\202\274v3\265<\267\r\16\0\0\0\16\0\0"..., 132) = 132

So a.zip is read even though the program does not contain
a single import statement.

What is the untruth I'm spreading?

Regards,
Martin



Reply to: