From 5139e190d83b33386d5f9968ec9e0239c662adc0 Mon Sep 17 00:00:00 2001
From: MinRK <benjaminrk@gmail.com>
Date: Thu, 28 Mar 2013 10:20:44 -0700
Subject: [PATCH 1/3] move DEFAULT_STATIC_FILES_PATH to frontend.html.notebook

and move the friendly version checks to notebookapp.py

DEFAULT_STATIC_FILES_PATH is now accessible without pyzmq/tornado/jinja being importable.
If someone tries to use old pyzmq or tornado directly with handlers,
the version check won't happen, but that's probably the right thing to do anyway.
---
 IPython/frontend/html/notebook/notebookapp.py | 23 +++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py
index c14acb68c..5b30239bf 100644
--- a/IPython/frontend/html/notebook/notebookapp.py
+++ b/IPython/frontend/html/notebook/notebookapp.py
@@ -31,7 +31,12 @@ import time
 import uuid
 import webbrowser
 
+
 # Third party
+# check for pyzmq 2.1.11 (this is actually redundant)
+from IPython.kernel.zmq import check_for_zmq
+check_for_zmq('2.1.11', 'IPython.frontend.html.notebook')
+
 import zmq
 from jinja2 import Environment, FileSystemLoader
 
@@ -40,11 +45,24 @@ from jinja2 import Environment, FileSystemLoader
 from zmq.eventloop import ioloop
 ioloop.install()
 
-import tornado
+# check for tornado 2.1.0
+msg = "The IPython Notebook requires tornado >= 2.1.0"
+try:
+    import tornado
+except ImportError:
+    raise ImportError(msg)
+try:
+    version_info = tornado.version_info
+except AttributeError:
+    raise ImportError(msg + ", but you have < 1.1.0")
+if version_info < (2,1,0):
+    raise ImportError(msg + ", but you have %s" % tornado.version)
+
 from tornado import httpserver
 from tornado import web
 
 # Our own libraries
+from IPython.frontend.html.notebook import DEFAULT_STATIC_FILES_PATH
 from .kernelmanager import MappingKernelManager
 from .handlers import (LoginHandler, LogoutHandler,
     ProjectDashboardHandler, NewHandler, NamedNotebookHandler,
@@ -98,9 +116,6 @@ ipython notebook --certfile=mycert.pem # use SSL/TLS certificate
 ipython notebook --port=5555 --ip=*    # Listen on port 5555, all interfaces
 """
 
-# Packagers: modify this line if you store the notebook static files elsewhere
-DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static")
-
 #-----------------------------------------------------------------------------
 # Helper functions
 #-----------------------------------------------------------------------------

From 7ad15715a0ff5275b31c09aa0e31a3a223698efe Mon Sep 17 00:00:00 2001
From: MinRK <benjaminrk@gmail.com>
Date: Thu, 28 Mar 2013 10:22:16 -0700
Subject: [PATCH 2/3] remove workarounds for no-longer-supported pyzmq versions

---
 IPython/frontend/html/notebook/notebookapp.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py
index 5b30239bf..329d35772 100644
--- a/IPython/frontend/html/notebook/notebookapp.py
+++ b/IPython/frontend/html/notebook/notebookapp.py
@@ -584,19 +584,7 @@ class NotebookApp(BaseIPythonApplication):
             self.exit(1)
     
     def init_signal(self):
-        # FIXME: remove this check when pyzmq dependency is >= 2.1.11
-        # safely extract zmq version info:
-        try:
-            zmq_v = zmq.pyzmq_version_info()
-        except AttributeError:
-            zmq_v = [ int(n) for n in re.findall(r'\d+', zmq.__version__) ]
-            if 'dev' in zmq.__version__:
-                zmq_v.append(999)
-            zmq_v = tuple(zmq_v)
-        if zmq_v >= (2,1,9) and not sys.platform.startswith('win'):
-            # This won't work with 2.1.7 and
-            # 2.1.9-10 will log ugly 'Interrupted system call' messages,
-            # but it will work
+        if not sys.platform.startswith('win'):
             signal.signal(signal.SIGINT, self._handle_sigint)
         signal.signal(signal.SIGTERM, self._signal_stop)
         if hasattr(signal, 'SIGUSR1'):

From cd0d29206f090719fc251a13699a71695b6dc1f9 Mon Sep 17 00:00:00 2001
From: MinRK <benjaminrk@gmail.com>
Date: Fri, 12 Apr 2013 21:33:49 -0700
Subject: [PATCH 3/3] move check_for_zmq to utils.zmqrelated

---
 IPython/frontend/html/notebook/notebookapp.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py
index 329d35772..ff96f8cf1 100644
--- a/IPython/frontend/html/notebook/notebookapp.py
+++ b/IPython/frontend/html/notebook/notebookapp.py
@@ -33,8 +33,8 @@ import webbrowser
 
 
 # Third party
-# check for pyzmq 2.1.11 (this is actually redundant)
-from IPython.kernel.zmq import check_for_zmq
+# check for pyzmq 2.1.11
+from IPython.utils.zmqrelated import check_for_zmq
 check_for_zmq('2.1.11', 'IPython.frontend.html.notebook')
 
 import zmq