Mercurial > public > mercurial-scm > hg
diff contrib/import-checker.py @ 32374:194b0f781132
import-checker: drop workaround for pure modules
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 13 Aug 2016 12:29:53 +0900 |
parents | df448de7cf3b |
children | d02888308235 |
line wrap: on
line diff
--- a/contrib/import-checker.py Sat Aug 13 12:28:52 2016 +0900 +++ b/contrib/import-checker.py Sat Aug 13 12:29:53 2016 +0900 @@ -24,10 +24,6 @@ 'mercurial.node', ) -# Modules that have both Python and C implementations. -_dualmodules = ( -) - # Modules that must be aliased because they are commonly confused with # common variables and can create aliasing and readability issues. requirealias = { @@ -59,13 +55,11 @@ todo.extend(ast.iter_child_nodes(node)) yield node, newscope -def dotted_name_of_path(path, trimpure=False): +def dotted_name_of_path(path): """Given a relative path to a source file, return its dotted module name. >>> dotted_name_of_path('mercurial/error.py') 'mercurial.error' - >>> dotted_name_of_path('mercurial/pure/parsers.py', trimpure=True) - 'mercurial.parsers' >>> dotted_name_of_path('zlibmodule.so') 'zlib' """ @@ -73,8 +67,6 @@ parts[-1] = parts[-1].split('.', 1)[0] # remove .py and .so and .ARCH.so if parts[-1].endswith('module'): parts[-1] = parts[-1][:-6] - if trimpure: - return '.'.join(p for p in parts if p != 'pure') return '.'.join(parts) def fromlocalfunc(modulename, localmods): @@ -695,8 +687,7 @@ used_imports = {} any_errors = False for source_path in argv[1:]: - trimpure = source_path.endswith(_dualmodules) - modname = dotted_name_of_path(source_path, trimpure=trimpure) + modname = dotted_name_of_path(source_path) localmods[modname] = source_path for localmodname, source_path in sorted(localmods.items()): for src, modname, name, line in sources(source_path, localmodname):