Commits

Erik Bray committed 10d4b7b

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

  • Participants
  • Parent commits 58b86e6
  • Branches sandbox-issue

Comments (0)

Files changed (2)

 
     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[:]
 

setuptools/sandbox.py

-import os, sys, __builtin__, tempfile, operator
+import os, sys, __builtin__, tempfile, operator, pkg_resources
 _os = sys.modules[os.name]
 try:
     _file = file
     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)
                 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]