diff options
author | PJ Eby <distutils-sig@python.org> | 2009-10-12 20:05:56 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2009-10-12 20:05:56 +0000 |
commit | 11e0e840b1d2b9b2e4326facb2f05eacec71bafa (patch) | |
tree | 276a6c43e121a2e98329bf011b235a45ef764634 /pkg_resources.py | |
parent | 9294929b0028f551a54dd48cc3325581933b3c5f (diff) | |
download | external_python_setuptools-11e0e840b1d2b9b2e4326facb2f05eacec71bafa.tar.gz external_python_setuptools-11e0e840b1d2b9b2e4326facb2f05eacec71bafa.tar.bz2 external_python_setuptools-11e0e840b1d2b9b2e4326facb2f05eacec71bafa.zip |
Backport fixes for issues 16 & 23 from trunk
--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075386
Diffstat (limited to 'pkg_resources.py')
-rw-r--r-- | pkg_resources.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index baff4225..79db00b8 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -20,18 +20,18 @@ try: except NameError: from sets import ImmutableSet as frozenset -from os import utime, rename, unlink # capture these to bypass sandboxing +# capture these to bypass sandboxing +from os import utime, rename, unlink, mkdir 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() + dirname, filename = split(name) + if dirname and filename and not isdir(dirname): + _bypass_ensure_directory(dirname) + mkdir(dirname, mode) @@ -957,7 +957,7 @@ variable to point to an accessible directory. extract_path = self.extraction_path or get_default_cache() target_path = os.path.join(extract_path, archive_name+'-tmp', *names) try: - ensure_directory(target_path) + _bypass_ensure_directory(target_path) except: self.extraction_error() |