Patchwork test-module-imports: conditionalize for Windows

login
register
mail settings
Submitter Matt Harbison
Date April 7, 2015, 1:56 a.m.
Message ID <2b99e04a81db2bba7b44.1428371784@Envy>
Download mbox | patch
Permalink /patch/8523/
State Rejected
Headers show

Comments

Matt Harbison - April 7, 2015, 1:56 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1428371471 14400
#      Mon Apr 06 21:51:11 2015 -0400
# Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
# Parent  e0fc84bf060e9c9ea69324860696e989831d76de
test-module-imports: conditionalize for Windows

Windows has several more warnings than posix platforms, notably changegroup.py,
encoding.py, and several posix.py entries.  I have no idea how to fix them, but
maybe it will inspire someone who knows how, to take a look.  This also means
less noise in a Windows buildbot.
Matt Mackall - April 7, 2015, 11:12 p.m.
On Mon, 2015-04-06 at 21:56 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1428371471 14400
> #      Mon Apr 06 21:51:11 2015 -0400
> # Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
> # Parent  e0fc84bf060e9c9ea69324860696e989831d76de
> test-module-imports: conditionalize for Windows
> 
> Windows has several more warnings than posix platforms, notably changegroup.py,
> encoding.py, and several posix.py entries.  I have no idea how to fix them, but
> maybe it will inspire someone who knows how, to take a look.  This also means
> less noise in a Windows buildbot.

I've never seen the warnings so I'm a bit reluctant to silence them.
Matt Harbison - April 8, 2015, 11:42 p.m.
On Tue, 07 Apr 2015 19:12:50 -0400, Matt Mackall <mpm@selenic.com> wrote:

> On Mon, 2015-04-06 at 21:56 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@yahoo.com>
>> # Date 1428371471 14400
>> #      Mon Apr 06 21:51:11 2015 -0400
>> # Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
>> # Parent  e0fc84bf060e9c9ea69324860696e989831d76de
>> test-module-imports: conditionalize for Windows
>>
>> Windows has several more warnings than posix platforms, notably  
>> changegroup.py,
>> encoding.py, and several posix.py entries.  I have no idea how to fix  
>> them, but
>> maybe it will inspire someone who knows how, to take a look.  This also  
>> means
>> less noise in a Windows buildbot.
>
> I've never seen the warnings so I'm a bit reluctant to silence them.

I'm confused.  The import cycle warnings for Windows are all included in  
the patch.  Were you thinking that I was trying to silence something else?
Augie Fackler - April 9, 2015, 12:12 a.m.
On Mon, Apr 06, 2015 at 09:56:24PM -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1428371471 14400
> #      Mon Apr 06 21:51:11 2015 -0400
> # Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
> # Parent  e0fc84bf060e9c9ea69324860696e989831d76de
> test-module-imports: conditionalize for Windows
>
> Windows has several more warnings than posix platforms, notably changegroup.py,
> encoding.py, and several posix.py entries.  I have no idea how to fix them, but
> maybe it will inspire someone who knows how, to take a look.  This also means
> less noise in a Windows buildbot.
>
> diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
> --- a/tests/test-module-imports.t
> +++ b/tests/test-module-imports.t
> @@ -20,6 +20,7 @@
>  hidden by deduplication algorithm in the cycle detector, so fixing
>  these may expose other cycles.
>
> +#if no-windows
>    $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
>    mercurial/crecord.py mixed imports
>       stdlib:    fcntl, termios
> @@ -40,3 +41,37 @@
>       stdlib:    formatter
>       relative:  config, error, scmutil, util
>    Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
> +#else
> +  $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
> +  mercurial/changegroup.py mixed imports
> +     stdlib:    os, struct, tempfile, zlib
> +     relative:  bz2

This one (just as an example) looks like bz2 is missing from your
python install, or else the logic in the import checker can't dig up
the existence of the bz2 module.

> +  mercurial/dispatch.py mixed imports
> +     stdlib:    commands
> +     relative:  error, extensions, fancyopts, hg, hook, util
> +  mercurial/encoding.py mixed imports
> +     stdlib:    locale, os
> +     relative:  unicodedata
> +  mercurial/fileset.py mixed imports
> +     stdlib:    parser
> +     relative:  error, merge, util
> +  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

Same type of problem here, presumably because fcntl only exists on unix-likes?

> +  mercurial/posix.py mixed imports
> +     stdlib:    array
> +     relative:  termios
> +  mercurial/revset.py mixed imports
> +     stdlib:    parser
> +     relative:  discovery, error, hbisect, phases, util
> +  mercurial/templater.py mixed imports
> +     stdlib:    parser
> +     relative:  config, error, templatefilters, templatekw, util
> +  mercurial/ui.py mixed imports
> +     stdlib:    formatter
> +     relative:  config, error, scmutil, util
> +  Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
> +#endif
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Matt Harbison - April 9, 2015, 12:33 a.m.
On Wed, 08 Apr 2015 20:12:14 -0400, Augie Fackler <raf@durin42.com> wrote:

> On Mon, Apr 06, 2015 at 09:56:24PM -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@yahoo.com>
>> # Date 1428371471 14400
>> #      Mon Apr 06 21:51:11 2015 -0400
>> # Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
>> # Parent  e0fc84bf060e9c9ea69324860696e989831d76de
>> test-module-imports: conditionalize for Windows
>>
>> Windows has several more warnings than posix platforms, notably  
>> changegroup.py,
>> encoding.py, and several posix.py entries.  I have no idea how to fix  
>> them, but
>> maybe it will inspire someone who knows how, to take a look.  This also  
>> means
>> less noise in a Windows buildbot.
>>
>> diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
>> --- a/tests/test-module-imports.t
>> +++ b/tests/test-module-imports.t
>> @@ -20,6 +20,7 @@
>>  hidden by deduplication algorithm in the cycle detector, so fixing
>>  these may expose other cycles.
>>
>> +#if no-windows
>>    $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python  
>> "$import_checker"
>>    mercurial/crecord.py mixed imports
>>       stdlib:    fcntl, termios
>> @@ -40,3 +41,37 @@
>>       stdlib:    formatter
>>       relative:  config, error, scmutil, util
>>    Import cycle: mercurial.cmdutil -> mercurial.context ->  
>> mercurial.subrepo -> mercurial.cmdutil
>> +#else
>> +  $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python  
>> "$import_checker"
>> +  mercurial/changegroup.py mixed imports
>> +     stdlib:    os, struct, tempfile, zlib
>> +     relative:  bz2
>
> This one (just as an example) looks like bz2 is missing from your
> python install, or else the logic in the import checker can't dig up
> the existence of the bz2 module.

Probably the latter:

$ python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]  
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import bz2
>>>

>> +  mercurial/dispatch.py mixed imports
>> +     stdlib:    commands
>> +     relative:  error, extensions, fancyopts, hg, hook, util
>> +  mercurial/encoding.py mixed imports
>> +     stdlib:    locale, os
>> +     relative:  unicodedata
>> +  mercurial/fileset.py mixed imports
>> +     stdlib:    parser
>> +     relative:  error, merge, util
>> +  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
>
> Same type of problem here, presumably because fcntl only exists on  
> unix-likes?

That seems right.  All of the various forum posts I found on google that  
quoted python docs for fcntl as "availability: unix", linked to dead  
python docs.  The current page [1] says "an interface to the fcntl() and  
ioctl() unix routines".

I don't mind trying to fix some of this stuff if they are real problems,  
but IDK how to interpret the output here.  The only thing I understand for  
sure is curses isn't in the list for Windows because the import is not at  
the top of the crecord module- see 01b39e821d00.

>> +  mercurial/posix.py mixed imports
>> +     stdlib:    array
>> +     relative:  termios
>> +  mercurial/revset.py mixed imports
>> +     stdlib:    parser
>> +     relative:  discovery, error, hbisect, phases, util
>> +  mercurial/templater.py mixed imports
>> +     stdlib:    parser
>> +     relative:  config, error, templatefilters, templatekw, util
>> +  mercurial/ui.py mixed imports
>> +     stdlib:    formatter
>> +     relative:  config, error, scmutil, util
>> +  Import cycle: mercurial.cmdutil -> mercurial.context ->  
>> mercurial.subrepo -> mercurial.cmdutil
>> +#endif
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel


[1] https://docs.python.org/2/library/fcntl.html
Augie Fackler - April 9, 2015, 12:34 a.m.
On Apr 8, 2015, at 8:33 PM, Matt Harbison <mharbison72@gmail.com> wrote:

> On Wed, 08 Apr 2015 20:12:14 -0400, Augie Fackler <raf@durin42.com> wrote:
> 
>> On Mon, Apr 06, 2015 at 09:56:24PM -0400, Matt Harbison wrote:
>>> # HG changeset patch
>>> # User Matt Harbison <matt_harbison@yahoo.com>
>>> # Date 1428371471 14400
>>> #      Mon Apr 06 21:51:11 2015 -0400
>>> # Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
>>> # Parent  e0fc84bf060e9c9ea69324860696e989831d76de
>>> test-module-imports: conditionalize for Windows
>>> 
>>> Windows has several more warnings than posix platforms, notably changegroup.py,
>>> encoding.py, and several posix.py entries.  I have no idea how to fix them, but
>>> maybe it will inspire someone who knows how, to take a look.  This also means
>>> less noise in a Windows buildbot.
>>> 
>>> diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
>>> --- a/tests/test-module-imports.t
>>> +++ b/tests/test-module-imports.t
>>> @@ -20,6 +20,7 @@
>>> hidden by deduplication algorithm in the cycle detector, so fixing
>>> these may expose other cycles.
>>> 
>>> +#if no-windows
>>>   $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
>>>   mercurial/crecord.py mixed imports
>>>      stdlib:    fcntl, termios
>>> @@ -40,3 +41,37 @@
>>>      stdlib:    formatter
>>>      relative:  config, error, scmutil, util
>>>   Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
>>> +#else
>>> +  $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
>>> +  mercurial/changegroup.py mixed imports
>>> +     stdlib:    os, struct, tempfile, zlib
>>> +     relative:  bz2
>> 
>> This one (just as an example) looks like bz2 is missing from your
>> python install, or else the logic in the import checker can't dig up
>> the existence of the bz2 module.
> 
> Probably the latter:
> 
> $ python
> Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import bz2
>>>> 

So, the thing to do (if possible) is figure out why, or just hack the import checker to know that bz2 is always a builtin.

>>> +  mercurial/dispatch.py mixed imports
>>> +     stdlib:    commands
>>> +     relative:  error, extensions, fancyopts, hg, hook, util
>>> +  mercurial/encoding.py mixed imports
>>> +     stdlib:    locale, os
>>> +     relative:  unicodedata
>>> +  mercurial/fileset.py mixed imports
>>> +     stdlib:    parser
>>> +     relative:  error, merge, util
>>> +  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
>> 
>> Same type of problem here, presumably because fcntl only exists on unix-likes?
> 
> That seems right.  All of the various forum posts I found on google that quoted python docs for fcntl as "availability: unix", linked to dead python docs.  The current page [1] says "an interface to the fcntl() and ioctl() unix routines".
> 
> I don't mind trying to fix some of this stuff if they are real problems, but IDK how to interpret the output here.  The only thing I understand for sure is curses isn't in the list for Windows because the import is not at the top of the crecord module- see 01b39e821d00.

Easy fix is to move re and fcntl imports to different lines.

> 
>>> +  mercurial/posix.py mixed imports
>>> +     stdlib:    array
>>> +     relative:  termios
>>> +  mercurial/revset.py mixed imports
>>> +     stdlib:    parser
>>> +     relative:  discovery, error, hbisect, phases, util
>>> +  mercurial/templater.py mixed imports
>>> +     stdlib:    parser
>>> +     relative:  config, error, templatefilters, templatekw, util
>>> +  mercurial/ui.py mixed imports
>>> +     stdlib:    formatter
>>> +     relative:  config, error, scmutil, util
>>> +  Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
>>> +#endif
>>> _______________________________________________
>>> Mercurial-devel mailing list
>>> Mercurial-devel@selenic.com
>>> http://selenic.com/mailman/listinfo/mercurial-devel
> 
> 
> [1] https://docs.python.org/2/library/fcntl.html
Matt Harbison - April 9, 2015, 1:56 a.m.
On Wed, 08 Apr 2015 20:34:42 -0400, Augie Fackler <raf@durin42.com> wrote:

>
> On Apr 8, 2015, at 8:33 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>
>> On Wed, 08 Apr 2015 20:12:14 -0400, Augie Fackler <raf@durin42.com>  
>> wrote:
>>
>>> On Mon, Apr 06, 2015 at 09:56:24PM -0400, Matt Harbison wrote:
>>>> # HG changeset patch
>>>> # User Matt Harbison <matt_harbison@yahoo.com>
>>>> # Date 1428371471 14400
>>>> #      Mon Apr 06 21:51:11 2015 -0400
>>>> # Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
>>>> # Parent  e0fc84bf060e9c9ea69324860696e989831d76de
>>>> test-module-imports: conditionalize for Windows
>>>>
>>>> Windows has several more warnings than posix platforms, notably  
>>>> changegroup.py,
>>>> encoding.py, and several posix.py entries.  I have no idea how to fix  
>>>> them, but
>>>> maybe it will inspire someone who knows how, to take a look.  This  
>>>> also means
>>>> less noise in a Windows buildbot.
>>>>
>>>> diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
>>>> --- a/tests/test-module-imports.t
>>>> +++ b/tests/test-module-imports.t
>>>> @@ -20,6 +20,7 @@
>>>> hidden by deduplication algorithm in the cycle detector, so fixing
>>>> these may expose other cycles.
>>>>
>>>> +#if no-windows
>>>>   $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python  
>>>> "$import_checker"
>>>>   mercurial/crecord.py mixed imports
>>>>      stdlib:    fcntl, termios
>>>> @@ -40,3 +41,37 @@
>>>>      stdlib:    formatter
>>>>      relative:  config, error, scmutil, util
>>>>   Import cycle: mercurial.cmdutil -> mercurial.context ->  
>>>> mercurial.subrepo -> mercurial.cmdutil
>>>> +#else
>>>> +  $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python  
>>>> "$import_checker"
>>>> +  mercurial/changegroup.py mixed imports
>>>> +     stdlib:    os, struct, tempfile, zlib
>>>> +     relative:  bz2
>>>
>>> This one (just as an example) looks like bz2 is missing from your
>>> python install, or else the logic in the import checker can't dig up
>>> the existence of the bz2 module.
>>
>> Probably the latter:
>>
>> $ python
>> Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit  
>> (Intel)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import bz2
>>>>>
>
> So, the thing to do (if possible) is figure out why, or just hack the  
> import checker to know that bz2 is always a builtin.
>
>>>> +  mercurial/dispatch.py mixed imports
>>>> +     stdlib:    commands
>>>> +     relative:  error, extensions, fancyopts, hg, hook, util
>>>> +  mercurial/encoding.py mixed imports
>>>> +     stdlib:    locale, os
>>>> +     relative:  unicodedata
>>>> +  mercurial/fileset.py mixed imports
>>>> +     stdlib:    parser
>>>> +     relative:  error, merge, util
>>>> +  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
>>>
>>> Same type of problem here, presumably because fcntl only exists on  
>>> unix-likes?
>>
>> That seems right.  All of the various forum posts I found on google  
>> that quoted python docs for fcntl as "availability: unix", linked to  
>> dead python docs.  The current page [1] says "an interface to the  
>> fcntl() and ioctl() unix routines".
>>
>> I don't mind trying to fix some of this stuff if they are real  
>> problems, but IDK how to interpret the output here.  The only thing I  
>> understand for sure is curses isn't in the list for Windows because the  
>> import is not at the top of the crecord module- see 01b39e821d00.
>
> Easy fix is to move re and fcntl imports to different lines.

That works, but should we just add fcntl to list_stdlib_modules() in the  
import checker so that it doesn't pop up again?  msvcrt, _winreg and  
others get this treatment, with a comment that they are actually Windows  
only.  This seems like the same concept, but IDK what the pros and cons  
are (if any).  I'm not clear either on how many of these  
standard-on-unix-but-not-windows modules should be added like this.

>>
>>>> +  mercurial/posix.py mixed imports
>>>> +     stdlib:    array
>>>> +     relative:  termios
>>>> +  mercurial/revset.py mixed imports
>>>> +     stdlib:    parser
>>>> +     relative:  discovery, error, hbisect, phases, util
>>>> +  mercurial/templater.py mixed imports
>>>> +     stdlib:    parser
>>>> +     relative:  config, error, templatefilters, templatekw, util
>>>> +  mercurial/ui.py mixed imports
>>>> +     stdlib:    formatter
>>>> +     relative:  config, error, scmutil, util
>>>> +  Import cycle: mercurial.cmdutil -> mercurial.context ->  
>>>> mercurial.subrepo -> mercurial.cmdutil
>>>> +#endif
>>>> _______________________________________________
>>>> Mercurial-devel mailing list
>>>> Mercurial-devel@selenic.com
>>>> http://selenic.com/mailman/listinfo/mercurial-devel
>>
>>
>> [1] https://docs.python.org/2/library/fcntl.html
Augie Fackler - April 9, 2015, 2:06 a.m.
On Apr 8, 2015, at 9:56 PM, Matt Harbison <mharbison72@gmail.com> wrote:

> On Wed, 08 Apr 2015 20:34:42 -0400, Augie Fackler <raf@durin42.com> wrote:
> 
>> 
>> On Apr 8, 2015, at 8:33 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>> 
>>> On Wed, 08 Apr 2015 20:12:14 -0400, Augie Fackler <raf@durin42.com> wrote:
>>> 
>>>> On Mon, Apr 06, 2015 at 09:56:24PM -0400, Matt Harbison wrote:
>>>>> # HG changeset patch
>>>>> # User Matt Harbison <matt_harbison@yahoo.com>
>>>>> # Date 1428371471 14400
>>>>> #      Mon Apr 06 21:51:11 2015 -0400
>>>>> # Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
>>>>> # Parent  e0fc84bf060e9c9ea69324860696e989831d76de
>>>>> test-module-imports: conditionalize for Windows
>>>>> 
>>>>> Windows has several more warnings than posix platforms, notably changegroup.py,
>>>>> encoding.py, and several posix.py entries.  I have no idea how to fix them, but
>>>>> maybe it will inspire someone who knows how, to take a look.  This also means
>>>>> less noise in a Windows buildbot.
>>>>> 
>>>>> diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
>>>>> --- a/tests/test-module-imports.t
>>>>> +++ b/tests/test-module-imports.t
>>>>> @@ -20,6 +20,7 @@
>>>>> hidden by deduplication algorithm in the cycle detector, so fixing
>>>>> these may expose other cycles.
>>>>> 
>>>>> +#if no-windows
>>>>>  $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
>>>>>  mercurial/crecord.py mixed imports
>>>>>     stdlib:    fcntl, termios
>>>>> @@ -40,3 +41,37 @@
>>>>>     stdlib:    formatter
>>>>>     relative:  config, error, scmutil, util
>>>>>  Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
>>>>> +#else
>>>>> +  $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
>>>>> +  mercurial/changegroup.py mixed imports
>>>>> +     stdlib:    os, struct, tempfile, zlib
>>>>> +     relative:  bz2
>>>> 
>>>> This one (just as an example) looks like bz2 is missing from your
>>>> python install, or else the logic in the import checker can't dig up
>>>> the existence of the bz2 module.
>>> 
>>> Probably the latter:
>>> 
>>> $ python
>>> Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>> import bz2
>>>>>> 
>> 
>> So, the thing to do (if possible) is figure out why, or just hack the import checker to know that bz2 is always a builtin.
>> 
>>>>> +  mercurial/dispatch.py mixed imports
>>>>> +     stdlib:    commands
>>>>> +     relative:  error, extensions, fancyopts, hg, hook, util
>>>>> +  mercurial/encoding.py mixed imports
>>>>> +     stdlib:    locale, os
>>>>> +     relative:  unicodedata
>>>>> +  mercurial/fileset.py mixed imports
>>>>> +     stdlib:    parser
>>>>> +     relative:  error, merge, util
>>>>> +  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
>>>> 
>>>> Same type of problem here, presumably because fcntl only exists on unix-likes?
>>> 
>>> That seems right.  All of the various forum posts I found on google that quoted python docs for fcntl as "availability: unix", linked to dead python docs.  The current page [1] says "an interface to the fcntl() and ioctl() unix routines".
>>> 
>>> I don't mind trying to fix some of this stuff if they are real problems, but IDK how to interpret the output here.  The only thing I understand for sure is curses isn't in the list for Windows because the import is not at the top of the crecord module- see 01b39e821d00.
>> 
>> Easy fix is to move re and fcntl imports to different lines.
> 
> That works, but should we just add fcntl to list_stdlib_modules() in the import checker so that it doesn't pop up again? msvcrt, _winreg and others get this treatment, with a comment that they are actually Windows only.  This seems like the same concept, but IDK what the pros and cons are (if any).  I'm not clear either on how many of these standard-on-unix-but-not-windows modules should be added like this.

That works fine for me.

> 
>>> 
>>>>> +  mercurial/posix.py mixed imports
>>>>> +     stdlib:    array
>>>>> +     relative:  termios
>>>>> +  mercurial/revset.py mixed imports
>>>>> +     stdlib:    parser
>>>>> +     relative:  discovery, error, hbisect, phases, util
>>>>> +  mercurial/templater.py mixed imports
>>>>> +     stdlib:    parser
>>>>> +     relative:  config, error, templatefilters, templatekw, util
>>>>> +  mercurial/ui.py mixed imports
>>>>> +     stdlib:    formatter
>>>>> +     relative:  config, error, scmutil, util
>>>>> +  Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
>>>>> +#endif
>>>>> _______________________________________________
>>>>> Mercurial-devel mailing list
>>>>> Mercurial-devel@selenic.com
>>>>> http://selenic.com/mailman/listinfo/mercurial-devel
>>> 
>>> 
>>> [1] https://docs.python.org/2/library/fcntl.html
Matt Mackall - April 9, 2015, 3:15 p.m.
On Wed, 2015-04-08 at 19:42 -0400, Matt Harbison wrote:
> On Tue, 07 Apr 2015 19:12:50 -0400, Matt Mackall <mpm@selenic.com> wrote:
> 
> > On Mon, 2015-04-06 at 21:56 -0400, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbison@yahoo.com>
> >> # Date 1428371471 14400
> >> #      Mon Apr 06 21:51:11 2015 -0400
> >> # Node ID 2b99e04a81db2bba7b44a59ea031481da60b70d3
> >> # Parent  e0fc84bf060e9c9ea69324860696e989831d76de
> >> test-module-imports: conditionalize for Windows
> >>
> >> Windows has several more warnings than posix platforms, notably  
> >> changegroup.py,
> >> encoding.py, and several posix.py entries.  I have no idea how to fix  
> >> them, but
> >> maybe it will inspire someone who knows how, to take a look.  This also  
> >> means
> >> less noise in a Windows buildbot.
> >
> > I've never seen the warnings so I'm a bit reluctant to silence them.
> 
> I'm confused.  The import cycle warnings for Windows are all included in  
> the patch.  Were you thinking that I was trying to silence something else?

I must have been misreading the patch.

Patch

diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
--- a/tests/test-module-imports.t
+++ b/tests/test-module-imports.t
@@ -20,6 +20,7 @@ 
 hidden by deduplication algorithm in the cycle detector, so fixing
 these may expose other cycles.
 
+#if no-windows
   $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
   mercurial/crecord.py mixed imports
      stdlib:    fcntl, termios
@@ -40,3 +41,37 @@ 
      stdlib:    formatter
      relative:  config, error, scmutil, util
   Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
+#else
+  $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
+  mercurial/changegroup.py mixed imports
+     stdlib:    os, struct, tempfile, zlib
+     relative:  bz2
+  mercurial/dispatch.py mixed imports
+     stdlib:    commands
+     relative:  error, extensions, fancyopts, hg, hook, util
+  mercurial/encoding.py mixed imports
+     stdlib:    locale, os
+     relative:  unicodedata
+  mercurial/fileset.py mixed imports
+     stdlib:    parser
+     relative:  error, merge, util
+  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
+  mercurial/revset.py mixed imports
+     stdlib:    parser
+     relative:  discovery, error, hbisect, phases, util
+  mercurial/templater.py mixed imports
+     stdlib:    parser
+     relative:  config, error, templatefilters, templatekw, util
+  mercurial/ui.py mixed imports
+     stdlib:    formatter
+     relative:  config, error, scmutil, util
+  Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
+#endif