Scrapy, a fast high-level web crawling & scraping framework for Python.
Removed (very old and possibly broken) backwards compatibility support for Twisted 2.5
Pablo Hoffmanb6ae2665461b
diff --git a/docs/intro/install.rst b/docs/intro/install.rstindex fda0d7058..4f7aa52be 100644--- a/docs/intro/install.rst+++ b/docs/intro/install.rst@@ -13,7 +13,7 @@ Requirements* `Python`_ 2.6, 2.7 (3.x is not yet supported)-* `Twisted`_ 2.5.0, 8.0 or above (Windows users: you'll need to install+* `Twisted`_ 8.0 or above (Windows users: you'll need to install`Zope.Interface`_ and maybe `pywin32`_ because of `this Twisted bug`_)* `w3lib`_diff --git a/scrapy/__init__.py b/scrapy/__init__.pyindex 99c366eb7..76f704f7a 100644--- a/scrapy/__init__.py+++ b/scrapy/__init__.py@@ -15,7 +15,7 @@ if sys.version_info < (2,6):warnings.filterwarnings('ignore', category=DeprecationWarning, module='twisted')# monkey patches to fix external library issues-from scrapy.xlib import twisted_250_monkeypatches, urlparse_monkeypatches+from scrapy.xlib import urlparse_monkeypatches# optional_features is a set containing Scrapy optional featuresoptional_features = set()diff --git a/scrapy/xlib/twisted_250_monkeypatches.py b/scrapy/xlib/twisted_250_monkeypatches.pydeleted file mode 100644index 56dc93f31..000000000--- a/scrapy/xlib/twisted_250_monkeypatches.py+++ /dev/null@@ -1,49 +0,0 @@-"""-Monkey patches for supporting Twisted 2.5.0--NOTE: This module must not fail if twisted module is not available.-"""--# This function comes bundled with Twisted 8.x and above-def add_missing_blockingCallFromThread():- import Queue- from twisted.internet import defer- from twisted.python import failure-- def blockingCallFromThread(reactor, f, *a, **kw):- """- Run a function in the reactor from a thread, and wait for the result- synchronously, i.e. until the callback chain returned by the function- get a result.-- @param reactor: The L{IReactorThreads} provider which will be used to- schedule the function call.- @param f: the callable to run in the reactor thread- @type f: any callable.- @param a: the arguments to pass to C{f}.- @param kw: the keyword arguments to pass to C{f}.-- @return: the result of the callback chain.- @raise: any error raised during the callback chain.- """- queue = Queue.Queue()- def _callFromThread():- result = defer.maybeDeferred(f, *a, **kw)- result.addBoth(queue.put)- reactor.callFromThread(_callFromThread)- result = queue.get()- if isinstance(result, failure.Failure):- result.raiseException()- return result-- from twisted.internet import threads- threads.blockingCallFromThread = blockingCallFromThread--try:- import twisted- from twisted.python.versions import Version- if twisted.version < Version("twisted", 8, 0, 0):- add_missing_blockingCallFromThread()-except ImportError:- pass-diff --git a/setup.py b/setup.pyindex 069c8cdf0..7bcd127a4 100644--- a/setup.py+++ b/setup.py@@ -120,7 +120,7 @@ try:except ImportError:from distutils.core import setupelse:- setup_args['install_requires'] = ['Twisted>=2.5', 'w3lib>=1.1', 'pyOpenSSL']+ setup_args['install_requires'] = ['Twisted>=8.0', 'w3lib>=1.1', 'pyOpenSSL']if sys.version_info < (2, 6):setup_args['install_requires'] += ['simplejson']try: