import-checker: exclude mercurial packages installed into the system path
authorYuya Nishihara <yuya@tcha.org>
Sat, 04 Jul 2015 10:56:37 +0900
changeset 25734 9086d0c1def3
parent 25733 f99c066f5f9a
child 25735 3948cb4d0ae7
import-checker: exclude mercurial packages installed into the system path If mercurial was installed into a directory other than the site-packages, test-module-imports.t failed as 'mercurial.node' was listed in stdlib_modules: testpackage/latesymbolimport.py relative import of stdlib module Instead, we should exclude our packages explicitly.
contrib/import-checker.py
--- a/contrib/import-checker.py	Sat Jul 04 10:54:03 2015 +0900
+++ b/contrib/import-checker.py	Sat Jul 04 10:56:37 2015 +0900
@@ -192,11 +192,10 @@
         # of any().
         if not any(libpath.startswith(p) for p in stdlib_prefixes): # no-py24
             continue
-        if 'site-packages' in libpath:
-            continue
         for top, dirs, files in os.walk(libpath):
             for i, d in reversed(list(enumerate(dirs))):
-                if not os.path.exists(os.path.join(top, d, '__init__.py')):
+                if (not os.path.exists(os.path.join(top, d, '__init__.py'))
+                    or top == libpath and d in ('hgext', 'mercurial')):
                     del dirs[i]
             for name in files:
                 if name == '__init__.py':