[Python-checkins] r52368 - sandbox/trunk/import_in_py/importer.py

brett.cannon python-checkins at python.org
Tue Oct 17 21:45:54 CEST 2006


Author: brett.cannon
Date: Tue Oct 17 21:45:54 2006
New Revision: 52368

Modified:
   sandbox/trunk/import_in_py/importer.py
Log:
Add notes on how one could add support for PTL files.  Also note how to
re-implement zipimport easily.


Modified: sandbox/trunk/import_in_py/importer.py
==============================================================================
--- sandbox/trunk/import_in_py/importer.py	(original)
+++ sandbox/trunk/import_in_py/importer.py	Tue Oct 17 21:45:54 2006
@@ -51,14 +51,26 @@
     type of object.
       
 PTL use-case:
-* XXX
+* Use filesystem importer and loader.
+* Subclass PyPycFileHandler
+    + Set source_handles to '.ptl' and bytecode to '.ptlc'.
+    + get_code_from_source()
+        - Handle transforming source to pure Python source.
+        - Return code object and timestamp.
                 
 zipimport use-case:
-* Simple way
-    + XXX
-* Feature-rich way
-    + XXX
-      
+* Importer
+    + Check if .pyc file exists for module in zip file.
+* Loader
+    + Read .pyc file into a StringIO instance.
+    + Set 'name' attribute to zip file plus file name.
+* Use PyPycFileHandler
+* Adding support for all-source zip files.
+    + Modify importer to detect if zip file is all .pyc of .py files.
+    + Create separate instances of PyPycFileHandler for source and
+      bytecode.
+        - Suppresses attempts to read other code type.
+  
 sqlite3 importer use-case:
 * Simple way (only support just bytecode or source)
     + DB


More information about the Python-checkins mailing list