Fix VFSImporter for modules that change their sys.modules definition (such as 'Pmw' and 'panda3d')

This commit is contained in:
rdb 2013-07-23 18:09:44 +00:00
parent 808ca386c4
commit bba6537f97

View File

@ -143,15 +143,15 @@ class VFSLoader:
if not code:
raise ImportError, 'No Python code in %s' % (fullname)
mod = sys.modules.setdefault(fullname, new.module(fullname))
mod = sys.modules.setdefault(fullname, imp.new_module(fullname))
mod.__file__ = self.filename.toOsSpecific()
mod.__loader__ = self
if self.packagePath:
mod.__path__ = [self.packagePath.toOsSpecific()]
#print >> sys.stderr, "loaded %s, path = %s" % (fullname, mod.__path__)
exec code in mod.__dict__
return mod
exec(code, mod.__dict__)
return sys.modules[fullname]
def getdata(self, path):
path = Filename(self.dir_path, Filename.fromOsSpecific(path))
@ -514,5 +514,4 @@ def reloadSharedPackages():
continue
reloadSharedPackage(mod)