Require Tornado >= 3.2

Survey of version available in the oldest distros we care about:

- Debian 8, squeeze: 3.2.2
- Debian 8, squeeze-backports: 4.2.0
- Ubuntu 16.04 LTS: 4.2.1
- Arch Linux: 4.4.2
This commit is contained in:
Stein Magnus Jodal 2016-10-26 00:35:36 +02:00
parent 70a07373ad
commit bbeb5c03aa
5 changed files with 12 additions and 21 deletions

View File

@ -8,8 +8,7 @@ python:
env:
- TOX_ENV=py27
- TOX_ENV=py27-tornado23
- TOX_ENV=py27-tornado31
- TOX_ENV=py27-tornado32
- TOX_ENV=docs
- TOX_ENV=flake8

View File

@ -10,6 +10,11 @@ v2.1.0 (UNRELEASED)
Feature release.
- Dependencies: Drop support for Tornado < 3.2. Though strictly a breaking
change, this shouldn't have any effect on what systems we support, as Tornado
3.2 or newer is available from the distros that include GStreamer >= 1.2.3,
which we already require.
- Core: Mopidy restores its last state when started. Can be enabled by setting
the config value :confval:`core/restore_state` to ``true``.

View File

@ -89,16 +89,12 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
@classmethod
def broadcast(cls, msg):
if hasattr(tornado.ioloop.IOLoop, 'current'):
loop = tornado.ioloop.IOLoop.current()
else:
loop = tornado.ioloop.IOLoop.instance() # Fallback for pre 3.0
loop = tornado.ioloop.IOLoop.current()
# This can be called from outside the Tornado ioloop, so we need to
# safely cross the thread boundary by adding a callback to the loop.
for client in cls.clients:
# One callback per client to keep time we hold up the loop short
# NOTE: Pre 3.0 does not support *args or **kwargs...
loop.add_callback(functools.partial(_send_broadcast, client, msg))
def initialize(self, core):
@ -139,10 +135,7 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
except Exception as e:
error_msg = encoding.locale_decode(e)
logger.error('WebSocket request error: %s', error_msg)
if self.ws_connection:
# Tornado 3.2+ checks if self.ws_connection is None before
# using it, but not older versions.
self.close()
self.close()
def check_origin(self, origin):
# Allow cross-origin WebSocket connections, like Tornado before 4.0

View File

@ -27,7 +27,7 @@ setup(
'Pykka >= 1.1',
'requests >= 2.0',
'setuptools',
'tornado >= 2.3',
'tornado >= 3.2',
],
extras_require={'http': []},
entry_points={

12
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = py27, py27-tornado23, py27-tornado31, docs, flake8
envlist = py27, py27-tornado32, docs, flake8
[testenv]
sitepackages = true
@ -17,17 +17,11 @@ deps =
pytest-xdist
responses
[testenv:py27-tornado23]
[testenv:py27-tornado32]
commands = py.test tests/http
deps =
{[testenv]deps}
tornado==2.3
[testenv:py27-tornado31]
commands = py.test tests/http
deps =
{[testenv]deps}
tornado==3.1.1
tornado==3.2.2
[testenv:docs]
deps = -r{toxinidir}/docs/requirements.txt