diff options
author | Philippe Pepiot <philippe.pepiot@logilab.fr> | 2017-01-20 16:07:39 +0100 |
---|---|---|
committer | Philippe Pepiot <philippe.pepiot@logilab.fr> | 2017-01-20 16:07:39 +0100 |
commit | 1f42d92dbca788c4ab7750ae8359b974134cf595 (patch) | |
tree | 3dd9f331ed43500907045ab01677438e71b6bb3a /logilab | |
parent | 6c9ed73a6a26affe441840b2e7e37c397a6d2221 (diff) | |
download | logilab-common-1f42d92dbca788c4ab7750ae8359b974134cf595.tar.gz |
[modutils] deprecate modpath_from_file
The method will likely fail if there somes symlinks in your python environment
and will certainly fail on a file that isn't in sys.path (like custom importers
using sys.meta_path).
Diffstat (limited to 'logilab')
-rw-r--r-- | logilab/common/modutils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/logilab/common/modutils.py b/logilab/common/modutils.py index 31b5b27..030cfa3 100644 --- a/logilab/common/modutils.py +++ b/logilab/common/modutils.py @@ -49,6 +49,7 @@ except ImportError: ZIPFILE = object() from logilab.common import STD_BLACKLIST, _handle_blacklist +from logilab.common.deprecation import deprecated # Notes about STD_LIB_DIR # Consider arch-specific installation for STD_LIB_DIR definition @@ -234,8 +235,11 @@ def _path_from_filename(filename): return filename +@deprecated('you should avoid using modpath_from_file()') def modpath_from_file(filename, extrapath=None): - """given a file path return the corresponding splitted module's name + """DEPRECATED: doens't play well with symlinks and sys.meta_path + + Given a file path return the corresponding splitted module's name (i.e name of a module or package splitted on '.') :type filename: str |