[PATCH 4 of 8] import-checker: check topname in stdlib_modules

Yuya Nishihara yuya at tcha.org
Thu Mar 31 10:20:31 EDT 2016


On Wed, 30 Mar 2016 04:24:04 -0500, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1459325315 0
> #      Wed Mar 30 08:08:35 2016 +0000
> # Node ID 9bdba93f0afd6ffe087663510f5198fdb8e40536
> # Parent  b051243155761ace5b23e98f8dd7a1b527ed1077
> import-checker: check topname in stdlib_modules
> 
> ctypes.util was being rejected, which is silly.
> 
> diff --git a/contrib/import-checker.py b/contrib/import-checker.py
> --- a/contrib/import-checker.py
> +++ b/contrib/import-checker.py
> @@ -407,8 +407,9 @@
>  
>                  lastname = name
>  
> +            topname = name.split('.')[0]
>              # stdlib imports should be before local imports.
> -            stdlib = name in stdlib_modules
> +            stdlib = topname in stdlib_modules or name in stdlib_modules

Do you mean ctypes.util isn't included in stdlib_modules? That sounds like
a bug of list_stdlib_modules().


More information about the Mercurial-devel mailing list