mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Fix VFSImporter for modules that change their sys.modules definition (such as 'Pmw' and 'panda3d')
This commit is contained in:
parent
808ca386c4
commit
bba6537f97
@ -143,15 +143,15 @@ class VFSLoader:
|
|||||||
if not code:
|
if not code:
|
||||||
raise ImportError, 'No Python code in %s' % (fullname)
|
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.__file__ = self.filename.toOsSpecific()
|
||||||
mod.__loader__ = self
|
mod.__loader__ = self
|
||||||
if self.packagePath:
|
if self.packagePath:
|
||||||
mod.__path__ = [self.packagePath.toOsSpecific()]
|
mod.__path__ = [self.packagePath.toOsSpecific()]
|
||||||
#print >> sys.stderr, "loaded %s, path = %s" % (fullname, mod.__path__)
|
#print >> sys.stderr, "loaded %s, path = %s" % (fullname, mod.__path__)
|
||||||
|
|
||||||
exec code in mod.__dict__
|
exec(code, mod.__dict__)
|
||||||
return mod
|
return sys.modules[fullname]
|
||||||
|
|
||||||
def getdata(self, path):
|
def getdata(self, path):
|
||||||
path = Filename(self.dir_path, Filename.fromOsSpecific(path))
|
path = Filename(self.dir_path, Filename.fromOsSpecific(path))
|
||||||
@ -514,5 +514,4 @@ def reloadSharedPackages():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
reloadSharedPackage(mod)
|
reloadSharedPackage(mod)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user