diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2017-01-07 13:37:37 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-01-07 13:37:37 -0500 |
commit | a0d35d47761a8bd7394cb9f2738169b07be3a005 (patch) | |
tree | 375334a5e61eb137b5411f92942b510f6024cea3 /setuptools/sandbox.py | |
parent | bbf6ac250a05fd51aa2a44ed3196837491bc9d60 (diff) | |
parent | 3c182f9f1eea89040fbfc88d1ccbed31ece6a00b (diff) | |
download | python-setuptools-git-issue-97.tar.gz |
Merge branch 'master' into issue-97issue-97
Diffstat (limited to 'setuptools/sandbox.py')
-rwxr-xr-x | setuptools/sandbox.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 39afd57e..817a3afa 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -241,8 +241,15 @@ def run_setup(setup_script, args): working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) + # __file__ should be a byte string on Python 2 (#712) + dunder_file = ( + setup_script + if isinstance(setup_script, str) else + setup_script.encode(sys.getfilesystemencoding()) + ) + def runner(): - ns = dict(__file__=setup_script, __name__='__main__') + ns = dict(__file__=dunder_file, __name__='__main__') _execfile(setup_script, ns) DirectorySandbox(setup_dir).run(runner) @@ -373,14 +380,6 @@ if hasattr(os, 'devnull'): else: _EXCEPTIONS = [] -try: - from win32com.client.gencache import GetGeneratePath - _EXCEPTIONS.append(GetGeneratePath()) - del GetGeneratePath -except ImportError: - # it appears pywin32 is not installed, so no need to exclude. - pass - class DirectorySandbox(AbstractSandbox): """Restrict operations to a single subdirectory - pseudo-chroot""" |