diff --git a/setup.py b/setup.py index 47c85c0e..cbbdb043 100644 --- a/setup.py +++ b/setup.py @@ -19,9 +19,16 @@ tornado_requires = [ "tornado>=4.0,<6.0", - "toro>=0.6" ] +try: + from tornado import version as tornado_version + if tornado_version < '5.0': + tornado_requires.append("toro>=0.6") +except ImportError: + # tornado will now only get installed and we'll get the newer one + pass + dev_requires = [ "cython>=0.23", "flake8>=2.5", diff --git a/thriftpy/tornado.py b/thriftpy/tornado.py index 54899576..b312ed4e 100644 --- a/thriftpy/tornado.py +++ b/thriftpy/tornado.py @@ -37,7 +37,11 @@ try: from tornado.locks import Lock except ImportError: - from toro import Lock + try: + from toro import Lock + except ImportError: + raise RuntimeError('With tornado {}, you need to install ' + '"toro"'.format(tornado_version)) logger = logging.getLogger(__name__) diff --git a/tox.ini b/tox.ini index 86328f81..eba38182 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,6 @@ commands = deps = pytest tornado>=4.0,<6.0 - toro cython [testenv:flake8]