[pypy-svn] r64412 - pypy/release/1.1.x/pypy/module/zipimport
tismer at codespeak.net
tismer at codespeak.net
Sun Apr 19 21:20:52 CEST 2009
Author: tismer
Date: Sun Apr 19 21:20:50 2009
New Revision: 64412
Modified:
pypy/release/1.1.x/pypy/module/zipimport/interp_zipimport.py
Log:
fix zipimport for windows: correct os.sep for nested module import
Modified: pypy/release/1.1.x/pypy/module/zipimport/interp_zipimport.py
==============================================================================
--- pypy/release/1.1.x/pypy/module/zipimport/interp_zipimport.py (original)
+++ pypy/release/1.1.x/pypy/module/zipimport/interp_zipimport.py Sun Apr 19 21:20:50 2009
@@ -137,10 +137,16 @@
filename = filename.replace(os.path.sep, ZIPSEP)
return filename
+ def corr_zname(self, fname):
+ if ZIPSEP != os.path.sep:
+ return fname.replace(ZIPSEP, os.path.sep)
+ else:
+ return fname
+
def import_py_file(self, space, modname, filename, buf, pkgpath):
w = space.wrap
w_mod = w(Module(space, w(modname)))
- real_name = self.name + os.path.sep + filename
+ real_name = self.name + os.path.sep + self.corr_zname(filename)
space.setattr(w_mod, w('__loader__'), space.wrap(self))
importing._prepare_module(space, w_mod, real_name, pkgpath)
result = importing.load_source_module(space, w(modname), w_mod,
@@ -187,7 +193,7 @@
pkgpath)
buf = buf[8:] # XXX ugly copy, should use sequential read instead
w_mod = w(Module(space, w(modname)))
- real_name = self.name + os.path.sep + filename
+ real_name = self.name + os.path.sep + self.corr_zname(filename)
space.setattr(w_mod, w('__loader__'), space.wrap(self))
importing._prepare_module(space, w_mod, real_name, pkgpath)
result = importing.load_compiled_module(space, w(modname), w_mod,
More information about the Pypy-commit
mailing list