tarek  committed 3620405

make sure pkg_resources can be imported in GAE - refs #73

  • Participants
  • Parent commits 6e4f706
  • Branches 0.6-maintenance

Comments (0)

Files changed (1)


     from sets import ImmutableSet as frozenset
 # capture these to bypass sandboxing
-from os import utime, rename, unlink, mkdir
+from os import utime
+    from os import mkdir, rename, unlink
+except ImportError:
+    # no write support, probably under GAE
+    WRITE_SUPPORT = False
 from os import open as os_open
 from os.path import isdir, split
 def _bypass_ensure_directory(name, mode=0777):
     # Sandbox-bypassing version of ensure_directory()
+    if not WRITE_SUPPORT:
+        raise IOError('"os.mkdir" not supported on this platform.')
     dirname, filename = split(name)
     if dirname and filename and not isdir(dirname):
         timestamp = time.mktime(date_time)
+            if not WRITE_SUPPORT:
+                raise IOError('"os.rename" and "os.unlink" are not supported '
+                              'on this platform')
             real_path = manager.get_cache_path(
                 self.egg_name, self._parts(zip_path)