contrib/import-checker.py
changeset 28700 35ad5bcdeb7e
parent 28400 a84fc98a8af5
child 28702 e44f671018e3
equal deleted inserted replaced
28699:5cc59dbd199f 28700:35ad5bcdeb7e
   198                 break
   198                 break
   199         else:
   199         else:
   200             stdlib_prefixes.add(dirname)
   200             stdlib_prefixes.add(dirname)
   201     for libpath in sys.path:
   201     for libpath in sys.path:
   202         # We want to walk everything in sys.path that starts with
   202         # We want to walk everything in sys.path that starts with
   203         # something in stdlib_prefixes. check-code suppressed because
   203         # something in stdlib_prefixes.
   204         # the ast module used by this script implies the availability
   204         if not any(libpath.startswith(p) for p in stdlib_prefixes):
   205         # of any().
       
   206         if not any(libpath.startswith(p) for p in stdlib_prefixes): # no-py24
       
   207             continue
   205             continue
   208         for top, dirs, files in os.walk(libpath):
   206         for top, dirs, files in os.walk(libpath):
   209             for i, d in reversed(list(enumerate(dirs))):
   207             for i, d in reversed(list(enumerate(dirs))):
   210                 if (not os.path.exists(os.path.join(top, d, '__init__.py'))
   208                 if (not os.path.exists(os.path.join(top, d, '__init__.py'))
   211                     or top == libpath and d in ('hgext', 'mercurial')):
   209                     or top == libpath and d in ('hgext', 'mercurial')):