diff hgdemandimport/demandimportpy2.py @ 32447:252d2260c74e

demandimport: look for 'mod' suffix as alternative name for module reference It's widely used in our codebase.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 28 Apr 2017 23:46:16 +0900
parents 63365e9621d6
children 91a2ec8e7fa0
line wrap: on
line diff
--- a/hgdemandimport/demandimportpy2.py	Mon May 01 14:26:56 2017 +0900
+++ b/hgdemandimport/demandimportpy2.py	Fri Apr 28 23:46:16 2017 +0900
@@ -132,8 +132,11 @@
                 subload(mod, x)
 
             # Replace references to this proxy instance with the actual module.
-            if locals and locals.get(head) is self:
-                locals[head] = mod
+            if locals:
+                if locals.get(head) is self:
+                    locals[head] = mod
+                elif locals.get(head + r'mod') is self:
+                    locals[head + r'mod'] = mod
 
             for modname in modrefs:
                 modref = sys.modules.get(modname, None)