contrib/import-checker.py
changeset 32212 65cd7e705ff6
parent 30590 74eecb93c617
child 32291 bd872f64a8ba
equal deleted inserted replaced
32211:c48583859e04 32212:65cd7e705ff6
    20     '__future__',
    20     '__future__',
    21     'mercurial.hgweb.common',
    21     'mercurial.hgweb.common',
    22     'mercurial.hgweb.request',
    22     'mercurial.hgweb.request',
    23     'mercurial.i18n',
    23     'mercurial.i18n',
    24     'mercurial.node',
    24     'mercurial.node',
       
    25 )
       
    26 
       
    27 # Modules that have both Python and C implementations.
       
    28 _dualmodules = (
       
    29     'base85.py',
       
    30     'bdiff.py',
       
    31     'diffhelpers.py',
       
    32     'mpatch.py',
       
    33     'osutil.py',
       
    34     'parsers.py',
    25 )
    35 )
    26 
    36 
    27 # Modules that must be aliased because they are commonly confused with
    37 # Modules that must be aliased because they are commonly confused with
    28 # common variables and can create aliasing and readability issues.
    38 # common variables and can create aliasing and readability issues.
    29 requirealias = {
    39 requirealias = {
   689         argv.extend(l.rstrip() for l in sys.stdin.readlines())
   699         argv.extend(l.rstrip() for l in sys.stdin.readlines())
   690     localmods = {}
   700     localmods = {}
   691     used_imports = {}
   701     used_imports = {}
   692     any_errors = False
   702     any_errors = False
   693     for source_path in argv[1:]:
   703     for source_path in argv[1:]:
   694         modname = dotted_name_of_path(source_path, trimpure=True)
   704         trimpure = source_path.endswith(_dualmodules)
       
   705         modname = dotted_name_of_path(source_path, trimpure=trimpure)
   695         localmods[modname] = source_path
   706         localmods[modname] = source_path
   696     for localmodname, source_path in sorted(localmods.items()):
   707     for localmodname, source_path in sorted(localmods.items()):
   697         for src, modname, name, line in sources(source_path, localmodname):
   708         for src, modname, name, line in sources(source_path, localmodname):
   698             try:
   709             try:
   699                 used_imports[modname] = sorted(
   710                 used_imports[modname] = sorted(