From 927b97322631bddb044e9cc8cf1b2d8d926d9bfc 2010-07-14 02:05:46 From: Fernando Perez Date: 2010-07-14 02:05:46 Subject: [PATCH] Suppress foolscap deprecation warnings, bug reported by Satra. Now we import foolscap components according to their api. I think these four files contain all the naked 'from foolscap import' statements we had, so all such warnings should be gone now. --- diff --git a/IPython/kernel/enginefc.py b/IPython/kernel/enginefc.py index ebeff5c..dc6b1c9 100644 --- a/IPython/kernel/enginefc.py +++ b/IPython/kernel/enginefc.py @@ -31,7 +31,13 @@ from zope.interface import Interface, implements, Attribute from twisted.internet.base import DelayedCall DelayedCall.debug = True -from foolscap import Referenceable, DeadReferenceError +try: + # This is preferred in foolscap v > 0.4.3 + from foolscap.api import Referenceable, DeadReferenceError +except ImportError: + # Fallback for older versions + from foolscap import Referenceable, DeadReferenceError + from foolscap.referenceable import RemoteReference from IPython.kernel.pbutil import packageFailure, unpackageFailure diff --git a/IPython/kernel/fcutil.py b/IPython/kernel/fcutil.py index 9f7c730..e4a3096 100644 --- a/IPython/kernel/fcutil.py +++ b/IPython/kernel/fcutil.py @@ -17,7 +17,12 @@ __docformat__ = "restructuredtext en" import os -from foolscap import Tub, UnauthenticatedTub +try: + # This is preferred in foolscap v > 0.4.3 + from foolscap.api import Tub, UnauthenticatedTub +except ImportError: + # Fallback for older versions + from foolscap import Tub, UnauthenticatedTub def check_furl_file_security(furl_file, secure): """Remove the old furl_file if changing security modes.""" diff --git a/IPython/kernel/multienginefc.py b/IPython/kernel/multienginefc.py index 30de28d..5a615c2 100644 --- a/IPython/kernel/multienginefc.py +++ b/IPython/kernel/multienginefc.py @@ -24,7 +24,12 @@ from zope.interface import Interface, implements from twisted.internet import defer from twisted.python import components, failure, log -from foolscap import Referenceable +try: + # This is preferred in foolscap v > 0.4.3 + from foolscap.api import Referenceable +except ImportError: + # Fallback for older versions + from foolscap import Referenceable from IPython.kernel import error from IPython.kernel.util import printer diff --git a/IPython/kernel/taskfc.py b/IPython/kernel/taskfc.py index e308f9b..518d977 100644 --- a/IPython/kernel/taskfc.py +++ b/IPython/kernel/taskfc.py @@ -25,7 +25,12 @@ from zope.interface import Interface, implements from twisted.internet import defer from twisted.python import components, failure -from foolscap import Referenceable +try: + # This is preferred in foolscap v > 0.4.3 + from foolscap.api import Referenceable +except ImportError: + # Fallback for older versions + from foolscap import Referenceable from IPython.kernel.twistedutil import blockingCallFromThread from IPython.kernel import error, task as taskmodule, taskclient