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:
parent
ce219738b9
commit
9b4be65327
1 changed files with 2 additions and 0 deletions
|
@ -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':
|
||||||
|
|
Loading…
Reference in a new issue