Patchwork [3,of,4] crecord: don't abort on Windows when curses isn't available

login
register
mail settings
Submitter Matt Harbison
Date March 21, 2015, 6:11 a.m.
Message ID <75ed9687553578e1253b.1426918263@Envy>
Download mbox | patch
Permalink /patch/8213/
State Accepted
Headers show

Comments

Matt Harbison - March 21, 2015, 6:11 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1426908913 14400
#      Fri Mar 20 23:35:13 2015 -0400
# Node ID 75ed9687553578e1253baf6b357cbe90076969a7
# Parent  ce3e2b1febb53e893943bae8582d1d75aca48da8
crecord: don't abort on Windows when curses isn't available

This is the hack portion of the previous patch, which can be backed out once we
figure out how to deal with curses.  Without this, the tests affected by the
import problem mentioned in the previous patch fail in exactly the same way, but
with the nicer 'module not available' error.
Pierre-Yves David - March 22, 2015, 12:59 a.m.
On 03/20/2015 11:11 PM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1426908913 14400
> #      Fri Mar 20 23:35:13 2015 -0400
> # Node ID 75ed9687553578e1253baf6b357cbe90076969a7
> # Parent  ce3e2b1febb53e893943bae8582d1d75aca48da8
> crecord: don't abort on Windows when curses isn't available
>
> This is the hack portion of the previous patch, which can be backed out once we
> figure out how to deal with curses.  Without this, the tests affected by the
> import problem mentioned in the previous patch fail in exactly the same way, but
> with the nicer 'module not available' error.

Wait what? you mean that mercurial have and hard dependant to curses now 
? If true this mean we should change things to only requires curse when 
we actually needs it.
Matt Harbison - March 22, 2015, 1:15 a.m.
On Sat, 21 Mar 2015 20:59:00 -0400, Pierre-Yves David  
<pierre-yves.david@ens-lyon.org> wrote:

>
>
> On 03/20/2015 11:11 PM, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@yahoo.com>
>> # Date 1426908913 14400
>> #      Fri Mar 20 23:35:13 2015 -0400
>> # Node ID 75ed9687553578e1253baf6b357cbe90076969a7
>> # Parent  ce3e2b1febb53e893943bae8582d1d75aca48da8
>> crecord: don't abort on Windows when curses isn't available
>>
>> This is the hack portion of the previous patch, which can be backed out  
>> once we
>> figure out how to deal with curses.  Without this, the tests affected  
>> by the
>> import problem mentioned in the previous patch fail in exactly the same  
>> way, but
>> with the nicer 'module not available' error.
>
> Wait what? you mean that mercurial have and hard dependant to curses now  
> ? If true this mean we should change things to only requires curse when  
> we actually needs it.

I guess it's a hard dependency.  IDK how much more massaging Laurent is  
doing on this code, and I'm not sure how to change that anyway.  Since the  
stack traces appeared to point to localrepo as near the beginning of the  
import chain, I'm surprised anything ran:

     'localrepo' -> 'subrepo' -> 'cmdutil' -> 'crecord'

I'm just looking to get the Windows tests running again in the short term.

Is bundling wcurses an option?  I did some quick search for it last night,  
but I've never used it before, and IDK what state it is in.

The tests actually run on Windows without it installed (with this series),  
so the tests aren't covering something (probably because it isn't  
interactive?)  But that seems like a big problem if something in core  
isn't available everywhere, and the tests don't detect it, no?

--Matt
Matt Mackall - March 23, 2015, 8:37 p.m.
On Sat, 2015-03-21 at 02:11 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1426908913 14400
> #      Fri Mar 20 23:35:13 2015 -0400
> # Node ID 75ed9687553578e1253baf6b357cbe90076969a7
> # Parent  ce3e2b1febb53e893943bae8582d1d75aca48da8
> crecord: don't abort on Windows when curses isn't available

I've queued this 3rd one as well in the interest of making forward
progress on this.

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -32,8 +32,9 @@ 
 try:
     curses
 except NameError:
-    raise util.Abort(
-        _('the python curses/wcurses module is not available/installed'))
+    if os.name != 'nt':  # Temporary hack to get running on Windows again
+        raise util.Abort(
+            _('the python curses/wcurses module is not available/installed'))
 
 _origstdout = sys.__stdout__ # used by gethw()