changeset 32413:194b0f781132

import-checker: drop workaround for pure modules
author Yuya Nishihara <yuya@tcha.org>
date Sat, 13 Aug 2016 12:29:53 +0900
parents 5700825889fb
children 04baab18d60a
files contrib/check-py3-compat.py contrib/import-checker.py
diffstat 2 files changed, 2 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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:
--- 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):