Commit 2b17a4ac authored by Stefan Behnel's avatar Stefan Behnel

fix some glitches in last pyximport changes

parent 2000b13b
......@@ -27,7 +27,7 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
or .dll ."""
assert os.path.exists(filename), "Could not find %s" % os.path.abspath(filename)
path, name = os.path.split(filename)
path, name = os.path.split(os.path.abspath(filename))
if not ext:
modname, extension = os.path.splitext(name)
......@@ -40,7 +40,7 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
pyxbuild_dir = os.path.join(path, "_pyxbld")
package_base_dir = path
for package_name in ext.name.split('.')[1::-1]:
for package_name in ext.name.split('.')[-2::-1]:
package_base_dir, pname = os.path.split(package_base_dir)
if pname != package_name:
# something is wrong - package path doesn't match file path
......
......@@ -205,7 +205,7 @@ def load_module(name, pyxfilename, pyxbuild_dir=None, is_package=False,
inplace=build_inplace, language_level=language_level)
mod = imp.load_dynamic(name, so_path)
if is_package and not hasattr(mod, '__path__'):
mod.__path__ = os.path.dirname(so_path)
mod.__path__ = [os.path.dirname(so_path)]
assert mod.__file__ == so_path, (mod.__file__, so_path)
except Exception:
if pyxargs.load_py_module_on_import_failure and pyxfilename.endswith('.py'):
......@@ -381,6 +381,7 @@ class LibLoader(object):
source_path, so_path, is_package = self._libs[fullname]
except KeyError:
raise ValueError("invalid module %s" % fullname)
_debug("Loading shared library module '%s' from %s", fullname, so_path)
return load_module(fullname, source_path, so_path=so_path, is_package=is_package)
def add_lib(self, fullname, path, so_path, is_package):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment