Patchwork [7,of,8] py3: make contrib/import-checker.py get along with itself

login
register
mail settings
Submitter Yuya Nishihara
Date May 14, 2016, 7:33 a.m.
Message ID <4bbd966a9ebc63eedbc0.1463211232@mimosa>
Download mbox | patch
Permalink /patch/15114/
State Accepted
Headers show

Comments

Yuya Nishihara - May 14, 2016, 7:33 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1463204025 -32400
#      Sat May 14 14:33:45 2016 +0900
# Node ID 4bbd966a9ebc63eedbc0c576cab9e8f2e851c8c8
# Parent  bf2b2d35f363c27372de2c5ebd3eef4cdbc9f304
py3: make contrib/import-checker.py get along with itself

Indent these imports to disable the rule of "not lexically sorted."
timeless - May 15, 2016, 3:09 p.m.
I'm pretty sure I had a change for py 3 or pypy or something which changed
these lines because one wasn't available, so I'm glad to see the import
indented, although the inline comment explanation isn't wonderful.
On May 14, 2016 12:34 AM, "Yuya Nishihara" <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1463204025 -32400
> #      Sat May 14 14:33:45 2016 +0900
> # Node ID 4bbd966a9ebc63eedbc0c576cab9e8f2e851c8c8
> # Parent  bf2b2d35f363c27372de2c5ebd3eef4cdbc9f304
> py3: make contrib/import-checker.py get along with itself
>
> Indent these imports to disable the rule of "not lexically sorted."
>
> diff --git a/contrib/import-checker.py b/contrib/import-checker.py
> --- a/contrib/import-checker.py
> +++ b/contrib/import-checker.py
> @@ -11,8 +11,9 @@ import sys
>  # Import a minimal set of stdlib modules needed for list_stdlib_modules()
>  # to work when run from a virtualenv.  The modules were chosen empirically
>  # so that the return value matches the return value without virtualenv.
> -import BaseHTTPServer
> -import zlib
> +if True: # disable lexical sorting checks
> +    import BaseHTTPServer
> +    import zlib
>
>  # Whitelist of modules that symbols can be directly imported from.
>  allowsymbolimports = (
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/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
@@ -11,8 +11,9 @@  import sys
 # Import a minimal set of stdlib modules needed for list_stdlib_modules()
 # to work when run from a virtualenv.  The modules were chosen empirically
 # so that the return value matches the return value without virtualenv.
-import BaseHTTPServer
-import zlib
+if True: # disable lexical sorting checks
+    import BaseHTTPServer
+    import zlib
 
 # Whitelist of modules that symbols can be directly imported from.
 allowsymbolimports = (