import-checker: list package directory as stdlib module
Before this patch, a directory containing __init__.py wasn't counted as a
module and __init__.pyc was listed as foo.bar.__init__ module.
--- a/contrib/import-checker.py Sun Dec 27 23:48:19 2015 +0900
+++ b/contrib/import-checker.py Sun Dec 27 23:37:14 2015 +0900
@@ -179,9 +179,6 @@
# consider them stdlib.
for m in ['msvcrt', '_winreg']:
yield m
- # These get missed too
- for m in 'ctypes', 'email', 'logging', 'multiprocessing':
- yield m
yield 'builtins' # python3 only
for m in 'fcntl', 'grp', 'pwd', 'termios': # Unix only
yield m
@@ -214,11 +211,12 @@
or top == libpath and d in ('hgext', 'mercurial')):
del dirs[i]
for name in files:
- if name == '__init__.py':
- continue
if not name.endswith(('.py', '.so', '.pyc', '.pyo', '.pyd')):
continue
- full_path = os.path.join(top, name)
+ if name.startswith('__init__.py'):
+ full_path = top
+ else:
+ full_path = os.path.join(top, name)
rel_path = full_path[len(libpath) + 1:]
mod = dotted_name_of_path(rel_path)
yield mod