summaryrefslogtreecommitdiff
path: root/setuptools/sandbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/sandbox.py')
-rwxr-xr-xsetuptools/sandbox.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index c2f14e7f..37fc60af 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -157,13 +157,16 @@ if hasattr(os, 'devnull'):
else:
_EXCEPTIONS = []
-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
+try:
+ win32com_pkg = os.path.dirname(__import__('win32com').__file__)
+ gen_py_pkg = os.path.join(win32com_pkg, 'gen_py')
+ _EXCEPTIONS.append(gen_py_pkg)
+except ImportError:
+ # it appears pywin32 is not installed, so no need to exclude.
+ pass
+except AttributeError:
+ # unexpected error getting __file__ from win32com
+ pass
class DirectorySandbox(AbstractSandbox):
"""Restrict operations to a single subdirectory - pseudo-chroot"""