Patchwork D11249: check-module-imports: ignore non-stdlib module installed by distribution

login
register
mail settings
Submitter phabricator
Date Aug. 4, 2021, 8:42 p.m.
Message ID <differential-rev-PHID-DREV-lttx2ixqodblqeel4onq-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49563/
State Superseded
Headers show

Comments

phabricator - Aug. 4, 2021, 8:42 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
pulkit accepted this revision.
This revision is now accepted and ready to land.
Alphare accepted this revision.

REVISION SUMMARY
  Previously, the check script would detect breezy as part of the stdlib if
  installed using the debian package manager.
  
  This silence the following complains:
  
  tests/test-convert-bzr.t:117: imports not lexically sorted: breezy.bzr.bzrdir < sys
  tests/test-convert-bzr.t:117: stdlib import "breezy.bzr.bzrdir" follows local import: breezy
  tests/test-convert-bzr-ghosts.t:7: imports not lexically sorted: breezy.bzr.bzrdir < sys
  tests/test-convert-bzr-ghosts.t:7: stdlib import "breezy.bzr.bzrdir" follows local import: breezy
  tests/test-convert-bzr-treeroot.t:7: imports not lexically sorted: breezy.bzr.bzrdir < sys
  tests/test-convert-bzr-treeroot.t:7: stdlib import "breezy.bzr.bzrdir" follows local import: breezy

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11249

AFFECTED FILES
  contrib/import-checker.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -278,6 +278,8 @@ 
         ):
             continue
         for top, dirs, files in os.walk(libpath):
+            if 'dist-packages' in top.split(os.path.sep):
+                continue
             for i, d in reversed(list(enumerate(dirs))):
                 if (
                     not os.path.exists(os.path.join(top, d, '__init__.py'))