[PATCH 1 of 5] port win32.py to using the Python ctypes library

Adrian Buehlmann adrian at cadifra.com
Tue Feb 8 12:39:54 CST 2011


On 2011-02-08 19:31, Steve Borho wrote:
> On Tue, Feb 8, 2011 at 12:14 PM, Adrian Buehlmann <adrian at cadifra.com> wrote:
>> On 2011-02-08 18:48, Steve Borho wrote:
>>> On Tue, Feb 8, 2011 at 10:52 AM, Adrian Buehlmann <adrian at cadifra.com> wrote:
>>>> # HG changeset patch
>>>> # User Adrian Buehlmann <adrian at cadifra.com>
>>>> # Date 1297121623 -3600
>>>> # Node ID 3ba4920422e9abcdc8b8634c5c12c68051286a8c
>>>> # Parent  69e69b131458023d21ec40aa48fc5299e43ce69b
>>>> port win32.py to using the Python ctypes library
>>>>
>>>> The pywin32 package is no longer needed.
>>>>
>>>> ctypes is now required for running Mercurial on Windows.
>>>>
>>>> ctypes is included in Python since version 2.5. For Python 2.4, ctypes is
>>>> available as an extra installer package for Windows.
>>>>
>>>> Also moved spawndetached() from windows.py to win32.py and fixed it, using
>>>> ctypes as well. spawndetached was defunct with Python 2.6.6 because Python
>>>> removed their undocumented subprocess.CreateProcess. This fixes
>>>> 'hg serve -d' on Windows.
>>>>
>>
>> [big snip]
>>
>>>>
>>>> -try:
>>>> -    # override functions with win32 versions if possible
>>>> -    from win32 import *
>>>> -except ImportError:
>>>> -    pass
>>>> +from win32 import *
>>>
>>> This probably deserves a separate patch, but there's little point in
>>> keeping both a windows.py and win32.py now.
>>>
>>
>> That's quite wrong, since windows.py depends on osutils.c and win32.py
>> doesn't (by the end of this series).
>>
>> I'd like to keep win32.py free of depending on osutils.c, so we can use
>> win32.py (as modified by this series) for pure mercurial in the future.
> 
> Ah, I see.  That probably deserves a comment near the imports so that
> the osutils dependency doesn't sneak back in.
> 

Good point. I'm so immersed in this stuff that I thought it is obvious
enough (I even work towards breaking this exact dependency in this
series :).

I promise to send a patch that adds such a comment as soon as this
series is in (provided of course, this series is accepted for inclusion).


More information about the Mercurial-devel mailing list