Commit 38ac5403 authored by Erik Bray's avatar Erik Bray

Adds some missing bits to the sandbox fix--need to actually save/restore the pkg_resources state.

--HG--
branch : distribute
extra : rebase_source : 961ca56f30a6aabb5d24eff3cabb527d1be93ae4
parent d76ad0a7
......@@ -710,6 +710,7 @@ class WorkingSet(object):
def __setstate__(self, (entries, keys, by_key, callbacks)):
self.entries = entries[:]
self.entry_keys = keys.copy()
self.by_key = by_key.copy()
self.callbacks = callbacks[:]
......
import os, sys, __builtin__, tempfile, operator
import os, sys, __builtin__, tempfile, operator, pkg_resources
_os = sys.modules[os.name]
try:
_file = file
......@@ -19,6 +19,7 @@ def run_setup(setup_script, args):
if not os.path.isdir(temp_dir): os.makedirs(temp_dir)
save_tmp = tempfile.tempdir
save_modules = sys.modules.copy()
pr_state = pkg_resources.__getstate__()
try:
tempfile.tempdir = temp_dir
os.chdir(setup_dir)
......@@ -36,6 +37,7 @@ def run_setup(setup_script, args):
raise
# Normal exit, just return
finally:
pkg_resources.__setstate__(pr_state)
sys.modules.update(save_modules)
for key in list(sys.modules):
if key not in save_modules: del sys.modules[key]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment