Restore things that were remembered by the setup_environment function
()
| 85 | oldstuff = (env.copy(), os.name, sys.platform, path.get_home_dir, IPython.__file__, os.getcwd()) |
| 86 | |
| 87 | def teardown_environment(): |
| 88 | """Restore things that were remembered by the setup_environment function |
| 89 | """ |
| 90 | (oldenv, os.name, sys.platform, path.get_home_dir, IPython.__file__, old_wd) = oldstuff |
| 91 | os.chdir(old_wd) |
| 92 | reload(path) |
| 93 | |
| 94 | for key in list(env): |
| 95 | if key not in oldenv: |
| 96 | del env[key] |
| 97 | env.update(oldenv) |
| 98 | if hasattr(sys, 'frozen'): |
| 99 | del sys.frozen |
| 100 | |
| 101 | # Build decorator that uses the setup_environment/setup_environment |
| 102 | with_environment = with_setup(setup_environment, teardown_environment) |