From ec6b47e5c6c22e63df5b218f519d8bd944d0d92f 2010-02-22 21:35:04 From: Brian Granger Date: 2010-02-22 21:35:04 Subject: [PATCH] Fixed foolscap imports. As of Foolscap 0.4.3, foolscap introduces a foolscap.api module that all top-level symbols must be imported from. Fixes https://bugs.launchpad.net/ipython/+bug/525805 --- diff --git a/IPython/kernel/enginefc.py b/IPython/kernel/enginefc.py index 0439fdc..fb6333b 100644 --- a/IPython/kernel/enginefc.py +++ b/IPython/kernel/enginefc.py @@ -28,7 +28,10 @@ from zope.interface import Interface, implements from twisted.internet.base import DelayedCall DelayedCall.debug = True -from foolscap import Referenceable, DeadReferenceError +try: + from foolscap.api import Referenceable, DeadReferenceError +except ImportError: + 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 2225be1..ec4de2e 100644 --- a/IPython/kernel/fcutil.py +++ b/IPython/kernel/fcutil.py @@ -24,7 +24,10 @@ from twisted.internet import reactor, defer from twisted.python import log import foolscap -from foolscap import Tub, UnauthenticatedTub +try: + from foolscap.api import Tub, UnauthenticatedTub +except ImportError: + from foolscap import Tub, UnauthenticatedTub from IPython.config.loader import Config from IPython.kernel.configobjfactory import AdaptedConfiguredObjectFactory diff --git a/IPython/kernel/multiengineclient.py b/IPython/kernel/multiengineclient.py index e3f0446..c206578 100644 --- a/IPython/kernel/multiengineclient.py +++ b/IPython/kernel/multiengineclient.py @@ -22,7 +22,11 @@ import warnings from twisted.python import components from twisted.python.failure import Failure from zope.interface import Interface, implements, Attribute -from foolscap import DeadReferenceError + +try: + from foolscap.api import DeadReferenceError +except ImportError: + from foolscap import DeadReferenceError from IPython.utils.coloransi import TermColors diff --git a/IPython/kernel/multienginefc.py b/IPython/kernel/multienginefc.py index 1af1edf..ff77ef4 100644 --- a/IPython/kernel/multienginefc.py +++ b/IPython/kernel/multienginefc.py @@ -24,7 +24,10 @@ from zope.interface import Interface, implements from twisted.internet import defer from twisted.python import components, failure -from foolscap import Referenceable +try: + from foolscap.api import Referenceable +except ImportError: + from foolscap import Referenceable from IPython.kernel import error from IPython.kernel import map as Map diff --git a/IPython/kernel/taskclient.py b/IPython/kernel/taskclient.py index b639bd4..a9dcad9 100644 --- a/IPython/kernel/taskclient.py +++ b/IPython/kernel/taskclient.py @@ -20,7 +20,11 @@ __docformat__ = "restructuredtext en" from zope.interface import Interface, implements from twisted.python import components -from foolscap import DeadReferenceError + +try: + from foolscap.api import DeadReferenceError +except ImportError: + from foolscap import DeadReferenceError from IPython.kernel.twistedutil import blockingCallFromThread from IPython.kernel import task, error diff --git a/IPython/kernel/taskfc.py b/IPython/kernel/taskfc.py index 69726a5..4b2c47c 100644 --- a/IPython/kernel/taskfc.py +++ b/IPython/kernel/taskfc.py @@ -24,7 +24,10 @@ from zope.interface import Interface, implements from twisted.internet import defer from twisted.python import components -from foolscap import Referenceable +try: + from foolscap.api import Referenceable +except ImportError: + from foolscap import Referenceable from IPython.kernel import task as taskmodule from IPython.kernel.clientinterfaces import (