summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Pepiot <philippe.pepiot@logilab.fr>2017-01-25 14:02:39 +0100
committerPhilippe Pepiot <philippe.pepiot@logilab.fr>2017-01-25 14:02:39 +0100
commit0be3291908df2109831b377f4e2f48d47e9a2429 (patch)
tree9366bba1c26b945f355264e8fcf5c549e709b7be
parent846950d49aca16fb3d848bf7e5851985377a3f73 (diff)
downloadlogilab-common-0be3291908df2109831b377f4e2f48d47e9a2429.tar.gz
[registry] fix autoreload with register_modnames()
Don't register bytecode files in '_lastmodifs'. With python 2 loader get_filename() seems to return either pyc or py file.
-rw-r--r--logilab/common/registry.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/logilab/common/registry.py b/logilab/common/registry.py
index 83f467b..07d4353 100644
--- a/logilab/common/registry.py
+++ b/logilab/common/registry.py
@@ -704,6 +704,9 @@ class RegistryStore(dict):
toload = []
for modname in modnames:
filepath = pkgutil.find_loader(modname).get_filename()
+ if filepath[-4:] in ('.pyc', '.pyo'):
+ # The source file *must* exists
+ filepath = filepath[:-1]
self._toloadmods[modname] = filepath
toload.append((filepath, modname))
for filepath, modname in toload: