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

Sean Farley sean at farley.io
Tue Dec 15 18:06:14 CST 2015


# HG changeset patch
# User Sean Farley <sean at 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.

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):


More information about the Mercurial-devel mailing list