[Python-checkins] r57517 - sandbox/trunk/import_in_py/zipimport_/tests.py sandbox/trunk/import_in_py/zipimport_/zipimport.py

brett.cannon python-checkins at python.org
Sun Aug 26 23:36:15 CEST 2007


Author: brett.cannon
Date: Sun Aug 26 23:36:15 2007
New Revision: 57517

Modified:
   sandbox/trunk/import_in_py/zipimport_/tests.py
   sandbox/trunk/import_in_py/zipimport_/zipimport.py
Log:
Cripple zipimport (for now) while a whitebox re-engineering rewrite takes
place.


Modified: sandbox/trunk/import_in_py/zipimport_/tests.py
==============================================================================
--- sandbox/trunk/import_in_py/zipimport_/tests.py	(original)
+++ sandbox/trunk/import_in_py/zipimport_/tests.py	Sun Aug 26 23:36:15 2007
@@ -199,8 +199,15 @@
 
 
 def test_main():
-    test_support.run_unittest(ZipImportErrorTests, ZipImportCreation,
-            FindModule, GetData, IsPackage, GetSource, GetCode, LoadModule)
+    test_support.run_unittest(ZipImportErrorTests,
+                                ZipImportCreation,
+                                #FindModule,
+                                #GetData,
+                                #IsPackage,
+                                #GetSource,
+                                #GetCode,
+                                #LoadModule
+                             )
 
 
 if __name__ == '__main__':

Modified: sandbox/trunk/import_in_py/zipimport_/zipimport.py
==============================================================================
--- sandbox/trunk/import_in_py/zipimport_/zipimport.py	(original)
+++ sandbox/trunk/import_in_py/zipimport_/zipimport.py	Sun Aug 26 23:36:15 2007
@@ -26,6 +26,7 @@
         than a zip file is passed in then ZipImportError is raised.
 
         """
+        raise NotImplementedError
         path = os.path.abspath(archivepath)
         # XXX Need to tweak to handle zip archive package info like
         # _pkg.zip/pkg
@@ -40,9 +41,11 @@
         self._path_cache = {}
 
     def __repr__(self):
+        raise NotImplementedError
         return '<zipimport.zipimporter instance for %r>' % self._path_entry
 
     def _check_paths(self, base_path):
+        raise NotImplementedError
         source_suffixes = importlib.suffix_list(imp.PY_SOURCE)
         bytecode_suffixes = importlib.suffix_list(imp.PY_COMPILED)
         source, bytecode = None, None
@@ -72,6 +75,7 @@
     def find_module(self, fullname, path=None):
         """Check if the specified module is contained within the zip file,
         returning self if it is or None if it is not."""
+        raise NotImplementedError
         path_name = fullname.replace('.', os.sep)
         # Look for a package.
         base_path = os.path.join(path_name, '__init__')
@@ -88,6 +92,7 @@
     def _resolve_path(self, internal_path):
         """Return the path to the file, consisting of the zip file and the path
         within the zip file (if the path is true)."""
+        raise NotImplementedError
         if internal_path:
             return os.path.join(self._zip_path, internal_path)
         else:
@@ -96,6 +101,7 @@
     def get_code(self, fullname):
         """Return the code object for the module, raising ZipImportError if the
         module is not found."""
+        raise NotImplementedError
         try:
             info = self._path_cache[fullname]
         except KeyError:
@@ -111,6 +117,7 @@
         source or bytecode files.
 
         """
+        raise NotImplementedError
         with contextlib.closing(zipfile.ZipFile(self._zip_path)) as zip_:
             try:
                 return zip_.open(pathname, 'r').read()
@@ -121,6 +128,7 @@
     def get_source(self, fullname):
         """Get the source code for the specified module, raising ZipImportError
         if the module does not exist, or None if only bytecode exists."""
+        raise NotImplementedError
         try:
             info = self._path_cache[fullname]
         except KeyError:
@@ -133,6 +141,7 @@
     def is_package(self, fullname):
         """Return True if the module name represents a package, False if it
         does not."""
+        raise NotImplementedError
         try:
             return self._path_cache[fullname][2]
         except KeyError:
@@ -141,6 +150,7 @@
     def mod_time(self, name):
         """Return the last modification time of the module's source code from
         the epoch (based on the local time)."""
+        raise NotImplementedError
         try:
             info = self._path_cache[fullname]
         except KeyError:
@@ -152,6 +162,7 @@
 
     def get_bytecode(self, name):
         """Get the bytecode for the module."""
+        raise NotImplementedError
         try:
             bytecode_path = self._path_cache[name][1]
         except KeyError:
@@ -161,11 +172,13 @@
 
     def write_bytecode(self, name, timestamp, data):
         """Return False as zip files are never modified."""
+        # XXX Worth implementing ability to write out to zip files?
         return False
 
     def load_module(self, fullname):
         """Load the specified module, returning the module or raising
         ZipImportError if the module could not be found."""
+        raise NotImplementedError
         try:
             info = self._path_cache[fullname]
         except KeyError:


More information about the Python-checkins mailing list