[modutils] Fix modutils.modpath_from_file (closes #100757)

authorDavid Douard <david.douard@logilab.fr>
changesetd7f5380c5d23
branchstable
phasepublic
hiddenno
parent revision#8724116a446a fix debian rev
child revision#347549396655 [modutils] fix load_module_from_path (closes #100935)
files modified by this revision
modutils.py
# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1343643513 -7200
# Mon Jul 30 12:18:33 2012 +0200
# Branch stable
# Node ID d7f5380c5d235dbc74e3109bf7ad9a99ef5befbb
# Parent 8724116a446a9d20cd7a98e41bba6a84017e01ac
[modutils] Fix modutils.modpath_from_file (closes #100757)

diff --git a/modutils.py b/modutils.py
@@ -235,13 +235,11 @@
1                                if pkg]
2                  if _check_init(path, submodpath[:-1]):
3                      return extrapath[path_].split('.') + submodpath
4      for path in sys.path:
5          path = abspath(path)
6 -        if path and base[:len(path)] == path:
7 -            if path.startswith(EXT_LIB_DIR):
8 -                continue
9 +        if path and base.startswith(path):
10              modpath = [pkg for pkg in base[len(path):].split(os.sep) if pkg]
11              if _check_init(path, modpath[:-1]):
12                  return modpath
13      raise ImportError('Unable to find module for %s in %s' % (
14          filename, ', \n'.join(sys.path)))