Patchwork [2,of,2] import-checker: force 'fcntl', 'grp', 'pwd', and 'termios' to stdlib modules

login
register
mail settings
Submitter Matt Harbison
Date April 9, 2015, 2:51 a.m.
Message ID <84c7786145a000e1d92b.1428547866@Envy>
Download mbox | patch
Permalink /patch/8568/
State Accepted
Headers show

Comments

Matt Harbison - April 9, 2015, 2:51 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1428546710 14400
#      Wed Apr 08 22:31:50 2015 -0400
# Node ID 84c7786145a000e1d92b31f508490fbd8c9d2534
# Parent  81873bb2a01d0b746171a7e7c07667009f501d9e
import-checker: force 'fcntl', 'grp', 'pwd', and 'termios' to stdlib modules

These are Unix only, and caused these additional warnings on Windows if they
aren't hardcoded as stdlib:

  mercurial/posix.py mixed imports
     stdlib:    errno, getpass, os, socket, stat, sys, tempfile
     relative:  grp, pwd, unicodedata
  mercurial/posix.py mixed imports
     stdlib:    re
     relative:  fcntl
  mercurial/posix.py mixed imports
     stdlib:    array
     relative:  termios

Additionally, this was missing on Windows:

  mercurial/crecord.py mixed imports
     stdlib:    fcntl, termios
     relative:  curses


https://docs.python.org/2/library/fcntl.html
https://docs.python.org/2/library/grp.html
https://docs.python.org/2/library/pwd.html
https://docs.python.org/2/library/termios.html
Augie Fackler - April 9, 2015, 3:20 p.m.
On Wed, Apr 08, 2015 at 10:51:06PM -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1428546710 14400
> #      Wed Apr 08 22:31:50 2015 -0400
> # Node ID 84c7786145a000e1d92b31f508490fbd8c9d2534
> # Parent  81873bb2a01d0b746171a7e7c07667009f501d9e
> import-checker: force 'fcntl', 'grp', 'pwd', and 'termios' to stdlib modules

queued these, many thanks for all your hard work on windows stuff

>
> These are Unix only, and caused these additional warnings on Windows if they
> aren't hardcoded as stdlib:
>
>   mercurial/posix.py mixed imports
>      stdlib:    errno, getpass, os, socket, stat, sys, tempfile
>      relative:  grp, pwd, unicodedata
>   mercurial/posix.py mixed imports
>      stdlib:    re
>      relative:  fcntl
>   mercurial/posix.py mixed imports
>      stdlib:    array
>      relative:  termios
>
> Additionally, this was missing on Windows:
>
>   mercurial/crecord.py mixed imports
>      stdlib:    fcntl, termios
>      relative:  curses
>
>
> https://docs.python.org/2/library/fcntl.html
> https://docs.python.org/2/library/grp.html
> https://docs.python.org/2/library/pwd.html
> https://docs.python.org/2/library/termios.html
>
> diff --git a/contrib/import-checker.py b/contrib/import-checker.py
> --- a/contrib/import-checker.py
> +++ b/contrib/import-checker.py
> @@ -61,6 +61,8 @@
>      for m in 'ctypes', 'email':
>          yield m
>      yield 'builtins' # python3 only
> +    for m in 'fcntl', 'grp', 'pwd', 'termios':  # Unix only
> +        yield m
>      stdlib_prefixes = set([sys.prefix, sys.exec_prefix])
>      # We need to supplement the list of prefixes for the search to work
>      # when run from within a virtualenv.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/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
@@ -61,6 +61,8 @@ 
     for m in 'ctypes', 'email':
         yield m
     yield 'builtins' # python3 only
+    for m in 'fcntl', 'grp', 'pwd', 'termios':  # Unix only
+        yield m
     stdlib_prefixes = set([sys.prefix, sys.exec_prefix])
     # We need to supplement the list of prefixes for the search to work
     # when run from within a virtualenv.