[Python-checkins] CVS: python/nondist/peps pep-0273.txt,1.4,1.5
Barry Warsaw
bwarsaw@users.sourceforge.net
Fri, 02 Nov 2001 12:44:59 -0800
Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv26983
Modified Files:
pep-0273.txt
Log Message:
Jim's latest update
Index: pep-0273.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0273.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pep-0273.txt 2001/10/31 14:46:21 1.4
--- pep-0273.txt 2001/11/02 20:44:57 1.5
***************
*** 12,17 ****
Abstract
! This PEP adds the ability to import compiled Python modules
! *.py[co] and packages from zip archives.
--- 12,17 ----
Abstract
! This PEP adds the ability to import Python modules
! *.py, *.py[co] and packages from zip archives.
***************
*** 27,36 ****
all supported Python platforms.
! Any files may be present in the zip archive, but only files *.pyc,
! *.pyo and __init__.py[co] are available for import. Zip import of
! *.py and dynamic modules (*.pyd, *.so) is disallowed.
! Just as sys.path currently has default directory names, default
! zip archive names are added too. Otherwise there is no way to
import all Python library files from an archive.
--- 27,36 ----
all supported Python platforms.
! Any files may be present in the zip archive, but only files
! *.py and *.py[co] are available for import. Zip import of
! dynamic modules (*.pyd, *.so) is disallowed.
! Just as sys.path currently has default directory names, a default
! zip archive name is added too. Otherwise there is no way to
import all Python library files from an archive.
***************
*** 69,86 ****
the dynload_*.c, and that's probably not a good idea.
! You also can't import source files *.py from a zip archive. The
! problem here is what to do with the compiled files. Python would
! normally write these to the same directory as *.py, but surely we
don't want to write to the zip file. We could write to the
directory of the zip archive, but that would clutter it up, not
! good if it is /usr/bin for example. We could just fail to write
! the compiled files, but that makes zip imports very slow, and the
! user would probably not figure out what is wrong. It is probably
! best for users to put *.pyc into zip archives in the first place,
! and this PEP enforces that rule.
! So the only imports zip archives support are *.pyc and *.pyo, plus
! the import of __init__.py[co] for packages, and the search of the
! subdirectory structure for the same.
--- 69,85 ----
the dynload_*.c, and that's probably not a good idea.
! When trying to import *.pyc, if it is not available then
! *.pyo will be used instead. And vice versa when looking for *.pyo.
! If neither *.pyc nor *.pyo is available, or if the magic numbers
! are invalid, then *.py will be compiled and used to satisfy the
! import, but the compiled file will not be saved. Python would
! normally write it to the same directory as *.py, but surely we
don't want to write to the zip file. We could write to the
directory of the zip archive, but that would clutter it up, not
! good if it is /usr/bin for example.
! Failing to write the compiled files will make zip imports very slow,
! and the user will probably not figure out what is wrong. So it
! is best to put *.pyc and *.pyo in the archive with the *.py.
***************
*** 143,147 ****
On Windows, the directory is the directory of sys.executable.
The zip archive name is always inserted as the second item
! in sys.path. The first always seems to be ''.
Implementation
--- 142,146 ----
On Windows, the directory is the directory of sys.executable.
The zip archive name is always inserted as the second item
! in sys.path. The first is the directory of the main.py (thanks Tim).
Implementation