Patchwork [3,of,5,stable] crecord: ensure that curses is False if not imported

login
register
mail settings
Submitter Sean Farley
Date Dec. 16, 2015, 12:06 a.m.
Message ID <bd8254a6cc25a040fc70.1450224374@laptop.office.atlassian.com>
Download mbox | patch
Permalink /patch/12062/
State Superseded
Commit ba30ef5bba95307ed5b1ca2a9ae1ff7b86220178
Delegated to: Laurent Charignon
Headers show

Comments

Sean Farley - Dec. 16, 2015, 12:06 a.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1450224006 28800
#      Tue Dec 15 16:00:06 2015 -0800
# Branch stable
# Node ID bd8254a6cc25a040fc70d10a7e1d06935865280f
# Parent  eb3ae2a5d034e0b4598bdb824e8584c983998820
crecord: ensure that curses is False if not imported

This provides no functional change but makes the next two patches easier to
review.

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -37,16 +37,19 @@  try:
 except ImportError:
     # I have no idea if wcurses works with crecord...
     try:
         import wcurses as curses
     except ImportError:
-        # wcurses is not shipped on Windows by default
-        pass
+        # wcurses is not shipped on Windows by default, or python is not
+        # compiled with curses
+        curses = False
 
+# On windows, curses can throw a NameError, so check for that here
 try:
     curses
 except NameError:
+    curses = False
     if os.name != 'nt':  # Temporary hack to get running on Windows again
         raise error.Abort(
             _('the python curses/wcurses module is not available/installed'))
 
 def checkcurses(ui):