contrib/import-checker.py
changeset 32252 65cd7e705ff6
parent 30595 74eecb93c617
child 32331 bd872f64a8ba
--- 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):