[PATCH] import-checker: exclude dist-packages tree from stdlib as well

Augie Fackler raf at durin42.com
Fri Jul 3 10:00:50 CDT 2015


> On Jul 3, 2015, at 9:48 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1435929436 -32400
> #      Fri Jul 03 22:17:16 2015 +0900
> # Node ID 506956b94ca90eec47dfd7d9746e129bc3ccf884
> # Parent  d3d2ba265e17af1d9700e3e99de4d012b1b31ab8
> import-checker: exclude dist-packages tree from stdlib as well
> 
> On Debian, packaged modules are installed into dist-packages, not to
> site-packages. Because of this, if we have mercurial installed, the test
> failed as 'mercurial.node' was listed in stdlib_modules:

Hmm. I think this means that the import-checker is running with too many things on its sys.path - does that make sense to you?

I’m not sure what we should do about it, but it definitely seems a bit undesirable to pick things up from diet-packages when we’re trying to analyze a working tree. Thoughts?

> 
>  testpackage/latesymbolimport.py relative import of stdlib module
> 
> https://wiki.debian.org/Python
> 
> diff --git a/contrib/import-checker.py b/contrib/import-checker.py
> --- a/contrib/import-checker.py
> +++ b/contrib/import-checker.py
> @@ -192,7 +192,7 @@ def list_stdlib_modules():
>         # of any().
>         if not any(libpath.startswith(p) for p in stdlib_prefixes): # no-py24
>             continue
> -        if 'site-packages' in libpath:
> +        if 'site-packages' in libpath or 'dist-packages' in libpath:
>             continue
>         for top, dirs, files in os.walk(libpath):
>             for name in files:
> @@ -202,7 +202,7 @@ def list_stdlib_modules():
>                         or name.endswith('.pyd')):
>                     continue
>                 full_path = os.path.join(top, name)
> -                if 'site-packages' in full_path:
> +                if 'site-packages' in full_path or 'dist-packages' in full_path:
>                     continue
>                 rel_path = full_path[len(libpath) + 1:]
>                 mod = dotted_name_of_path(rel_path)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150703/c15511d9/attachment.pgp>


More information about the Mercurial-devel mailing list