[PATCH] test-module-imports: conditionalize for Windows

Augie Fackler raf at durin42.com
Wed Apr 8 21:06:02 CDT 2015


On Apr 8, 2015, at 9:56 PM, Matt Harbison <mharbison72 at gmail.com> wrote:

> On Wed, 08 Apr 2015 20:34:42 -0400, Augie Fackler <raf at durin42.com> wrote:
> 
>> 
>> On Apr 8, 2015, at 8:33 PM, Matt Harbison <mharbison72 at gmail.com> wrote:
>> 
>>> On Wed, 08 Apr 2015 20:12:14 -0400, Augie Fackler <raf at durin42.com> wrote:
>>> 
>>>> On Mon, Apr 06, 2015 at 09:56:24PM -0400, Matt Harbison wrote:
>>>>> # HG changeset patch
>>>>> # User Matt Harbison <matt_harbison at 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 at selenic.com
>>>>> http://selenic.com/mailman/listinfo/mercurial-devel
>>> 
>>> 
>>> [1] https://docs.python.org/2/library/fcntl.html

-------------- 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/20150408/e7c7f498/attachment.pgp>


More information about the Mercurial-devel mailing list