mirror of https://github.com/scrapy/scrapy.git
Removed (very old and possibly broken) backwards compatibility support for Twisted 2.5
This commit is contained in:
parent
9fddc73ed8
commit
b6ae266546
|
|
@ -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`_
|
||||
|
|
|
|||
|
|
@ -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 features
|
||||
optional_features = set()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
2
setup.py
2
setup.py
|
|
@ -120,7 +120,7 @@ try:
|
|||
except ImportError:
|
||||
from distutils.core import setup
|
||||
else:
|
||||
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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue