# HG changeset patch # User Yuya Nishihara # Date 1471058993 -32400 # Node ID 194b0f781132e1347828ea8ea3507ae3b310dd17 # Parent 5700825889fbbf1e299a898542833b2074808605 import-checker: drop workaround for pure modules diff -r 5700825889fb -r 194b0f781132 contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py Sat Aug 13 12:28:52 2016 +0900 +++ b/contrib/check-py3-compat.py Sat Aug 13 12:29:53 2016 +0900 @@ -15,10 +15,6 @@ import sys import traceback -# Modules that have both Python and C implementations. -_dualmodules = ( -) - def check_compat_py2(f): """Check Python 3 compatibility for a file with Python 2""" with open(f, 'rb') as fh: @@ -60,8 +56,6 @@ if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'): assert f.endswith('.py') name = f.replace('/', '.')[:-3] - if f.endswith(_dualmodules): - name = name.replace('.pure.', '.') try: importlib.import_module(name) except Exception as e: diff -r 5700825889fb -r 194b0f781132 contrib/import-checker.py --- 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):