python: make the DictImporter's unload() work in any context.

import sys since sys may not be defined in whatever context the DictImporter
is used.  Also reset self.installed after an unload since the same DictImporter
could be used again

--HG--
extra : convert_revision : 988ed7ad8cd41b69e8fc583e618b1b4a146216da
This commit is contained in:
Nathan Binkert 2007-08-13 13:39:22 -07:00
parent ce219738b9
commit 9b4be65327

View file

@ -46,8 +46,10 @@ class DictImporter(object):
self.unload() self.unload()
def unload(self): def unload(self):
import sys
for module in self.installed: for module in self.installed:
del sys.modules[module] del sys.modules[module]
self.installed = set()
def find_module(self, fullname, path): def find_module(self, fullname, path):
if fullname == '__scons': if fullname == '__scons':