diff options
-rwxr-xr-x | setuptools.txt | 3 | ||||
-rwxr-xr-x | setuptools/sandbox.py | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/setuptools.txt b/setuptools.txt index 231ed340..749a06bc 100755 --- a/setuptools.txt +++ b/setuptools.txt @@ -2612,6 +2612,9 @@ Release Notes/Change History ---------------------------- 0.6final + * Packages required at build time where not fully present at install time. + This closes http://bitbucket.org/tarek/distribute/issue/12. + * Protected against failures in tarfile extraction. This closes http://bitbucket.org/tarek/distribute/issue/10. diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 97865dd9..11c14938 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -6,10 +6,8 @@ from distutils.errors import DistutilsError __all__ = [ "AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup", ] - def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" - old_dir = os.getcwd() save_argv = sys.argv[:] save_path = sys.path[:] @@ -17,7 +15,7 @@ def run_setup(setup_script, args): temp_dir = os.path.join(setup_dir,'temp') if not os.path.isdir(temp_dir): os.makedirs(temp_dir) save_tmp = tempfile.tempdir - + save_modules = sys.modules.copy() try: tempfile.tempdir = temp_dir os.chdir(setup_dir) @@ -35,6 +33,9 @@ def run_setup(setup_script, args): raise # Normal exit, just return finally: + sys.modules.update(save_modules) + for key in list(sys.modules): + if key not in save_modules: del sys.modules[key] os.chdir(old_dir) sys.path[:] = save_path sys.argv[:] = save_argv |