From 2b17a4acae7bf53aa37deec1ce447e284ddf33c9 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 6 Aug 2012 15:51:17 +0200 Subject: fix some glitches in last pyximport changes --- pyximport/pyxbuild.py | 4 ++-- pyximport/pyximport.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'pyximport') diff --git a/pyximport/pyxbuild.py b/pyximport/pyxbuild.py index 02e733165..3218f6d22 100644 --- a/pyximport/pyxbuild.py +++ b/pyximport/pyxbuild.py @@ -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 diff --git a/pyximport/pyximport.py b/pyximport/pyximport.py index 8e3dc59fd..43814e15b 100644 --- a/pyximport/pyximport.py +++ b/pyximport/pyximport.py @@ -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): -- cgit v1.2.1