aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/sandbox.py
diff options
context:
space:
mode:
authorTarek Ziade <tarek@ziade.org>2010-05-06 18:10:32 +0200
committerTarek Ziade <tarek@ziade.org>2010-05-06 18:10:32 +0200
commit6a6a261fa50522d77fba6d6345fb71ba9f00c311 (patch)
tree4d025291624e9ce33cfed1400b13907d8384d145 /setuptools/sandbox.py
parent3cd5038930832fce95fb41d20150e173eb9894b5 (diff)
downloadexternal_python_setuptools-6a6a261fa50522d77fba6d6345fb71ba9f00c311.tar.gz
external_python_setuptools-6a6a261fa50522d77fba6d6345fb71ba9f00c311.tar.bz2
external_python_setuptools-6a6a261fa50522d77fba6d6345fb71ba9f00c311.zip
make sure all tests passes on all python versions fixes #149
--HG-- branch : distribute extra : rebase_source : 6288f4fcf65083b9d4ffb0ea8b35af44e699b4d5
Diffstat (limited to 'setuptools/sandbox.py')
-rwxr-xr-xsetuptools/sandbox.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 630d5792..13cbe109 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -152,13 +152,18 @@ class AbstractSandbox:
)
-_EXCEPTIONS = [os.devnull,]
+if hasattr(os, 'devnull'):
+ _EXCEPTIONS = [os.devnull,]
+else:
+ _EXCEPTIONS = []
-try:
- gen_py = os.path.dirname(__import__('win32com.gen_py', fromlist=['__name__']).__file__)
- _EXCEPTIONS.append(gen_py)
-except ImportError:
- pass
+if not sys.version < '2.5':
+ try:
+ gen_py = os.path.dirname(__import__('win32com.gen_py',
+ fromlist=['__name__']).__file__)
+ _EXCEPTIONS.append(gen_py)
+ except ImportError:
+ pass
class DirectorySandbox(AbstractSandbox):
"""Restrict operations to a single subdirectory - pseudo-chroot"""
@@ -204,7 +209,7 @@ class DirectorySandbox(AbstractSandbox):
def _exempted(self, filepath):
exception_matches = map(filepath.startswith, self._exceptions)
- return any(exception_matches)
+ return False not in exception_matches
def _remap_input(self,operation,path,*args,**kw):
"""Called for path inputs"""