From f9cd1da38fed22f88b02fa89cfbee76f00c04ee9 2011-10-30 23:08:39
From: MinRK <benjaminrk@gmail.com>
Date: 2011-10-30 23:08:39
Subject: [PATCH] fix pyzmq check in setupext to handle 2.1.10

closes gh-870

---

diff --git a/setupext/setupext.py b/setupext/setupext.py
index c97c768..a78d7ea 100644
--- a/setupext/setupext.py
+++ b/setupext/setupext.py
@@ -136,13 +136,25 @@ def check_for_pyzmq():
     try:
         import zmq
     except ImportError:
-        print_status('pyzmq', "no (required for qtconsole and parallel computing capabilities)")
+        print_status('pyzmq', "no (required for qtconsole, notebook, and parallel computing capabilities)")
         return False
     else:
+        # pyzmq 2.1.10 adds pyzmq_version_info funtion for returning
+        # version as a tuple
+        if hasattr(zmq, 'pyzmq_version_info'):
+            if zmq.pyzmq_version_info() >= (2,1,4):
+                print_status("pyzmq", zmq.__version__)
+                return True
+            else:
+                # this branch can never occur, at least until we update our
+                # pyzmq dependency beyond 2.1.10
+                return False
+        # this is necessarily earlier than 2.1.10, so string comparison is
+        # okay
         if zmq.__version__ < '2.1.4':
             print_status('pyzmq', "no (have %s, but require >= 2.1.4 for"
             " qtconsole and parallel computing capabilities)"%zmq.__version__)
-
+            return False
         else:
             print_status("pyzmq", zmq.__version__)
             return True