summaryrefslogtreecommitdiff
path: root/pkg_resources.py
diff options
context:
space:
mode:
authorDaniel Stutzbach <daniel@stutzbachenterprises.com>2009-10-19 08:43:45 -0500
committerDaniel Stutzbach <daniel@stutzbachenterprises.com>2009-10-19 08:43:45 -0500
commit7572da337f94c328f00100dc55f494c9d811f4bd (patch)
tree70dbc2a3ac69c1322ae5b0da64a7ffb550dc4c56 /pkg_resources.py
parent39be786e197fd135dac23a9102d257877985ebf0 (diff)
parentfe015037cc3ff5c0061bd2f427775ad665bda61c (diff)
downloadpython-setuptools-git-7572da337f94c328f00100dc55f494c9d811f4bd.tar.gz
Merged bugfixes from the danielstutzbach fork
--HG-- branch : distribute extra : rebase_source : cce25468ec8f18af01e99af60cdaaf0fb4a72ee9
Diffstat (limited to 'pkg_resources.py')
-rw-r--r--pkg_resources.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index 49c26620..31d83554 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -21,7 +21,14 @@ except NameError:
from sets import ImmutableSet as frozenset
# capture these to bypass sandboxing
-from os import utime, rename, unlink, mkdir
+from os import utime
+try:
+ from os import mkdir, rename, unlink
+ WRITE_SUPPORT = True
+except ImportError:
+ # no write support, probably under GAE
+ WRITE_SUPPORT = False
+
from os import open as os_open
from os.path import isdir, split
@@ -36,6 +43,8 @@ _distribute = True
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):
_bypass_ensure_directory(dirname)
@@ -1332,6 +1341,10 @@ class ZipProvider(EggProvider):
timestamp = time.mktime(date_time)
try:
+ 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)
)