diff contrib/import-checker.py @ 32212:65cd7e705ff6

policy: eliminate ".pure." from module name only if marked as dual So we can switch cext/pure modules to new layout one by one.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 13 Aug 2016 17:21:58 +0900
parents 74eecb93c617
children bd872f64a8ba
line wrap: on
line diff
--- a/contrib/import-checker.py	Fri Aug 12 11:06:14 2016 +0900
+++ b/contrib/import-checker.py	Sat Aug 13 17:21:58 2016 +0900
@@ -24,6 +24,16 @@
     'mercurial.node',
 )
 
+# Modules that have both Python and C implementations.
+_dualmodules = (
+    'base85.py',
+    'bdiff.py',
+    'diffhelpers.py',
+    'mpatch.py',
+    'osutil.py',
+    'parsers.py',
+)
+
 # Modules that must be aliased because they are commonly confused with
 # common variables and can create aliasing and readability issues.
 requirealias = {
@@ -691,7 +701,8 @@
     used_imports = {}
     any_errors = False
     for source_path in argv[1:]:
-        modname = dotted_name_of_path(source_path, trimpure=True)
+        trimpure = source_path.endswith(_dualmodules)
+        modname = dotted_name_of_path(source_path, trimpure=trimpure)
         localmods[modname] = source_path
     for localmodname, source_path in sorted(localmods.items()):
         for src, modname, name, line in sources(source_path, localmodname):