Fix python 2.5 support
* Avoid using property.setter(), use old-style properties instead. * Avoid using the new pep8-style threading API. * Use from __future__ import with_statement where it is used. * Add python 2.5 environments to tox, no epolls since that did not yet exist.
This commit is contained in:
@@ -36,33 +36,23 @@ class _GreenThread(object):
|
||||
def join(self, timeout=None):
|
||||
return self._g.wait()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
self._name = str(name)
|
||||
|
||||
def getName(self):
|
||||
return self.name
|
||||
return self._name
|
||||
get_name = getName
|
||||
|
||||
def setName(self, name):
|
||||
self.name = name
|
||||
self._name = str(name)
|
||||
set_name = setName
|
||||
|
||||
@property
|
||||
def ident(self):
|
||||
return id(self._g)
|
||||
name = property(getName, setName)
|
||||
|
||||
ident = property(lambda self: id(self._g))
|
||||
|
||||
def isAlive(self):
|
||||
return True
|
||||
is_alive = isAlive
|
||||
|
||||
@property
|
||||
def daemon(self):
|
||||
return True
|
||||
daemon = property(lambda self: True)
|
||||
|
||||
def isDaemon(self):
|
||||
return self.daemon
|
||||
@@ -111,7 +101,7 @@ def current_thread():
|
||||
# Not a GreenThread type, so there's no way to hook into
|
||||
# the green thread exiting. Fall back to the standard
|
||||
# function then.
|
||||
t = _fixup_thread(__orig_threading.current_thread())
|
||||
t = _fixup_thread(__orig_threading.currentThread())
|
||||
else:
|
||||
t = active[id(g)] = _GreenThread(g)
|
||||
|
||||
|
@@ -1,5 +1,8 @@
|
||||
"""The :mod:`zmq` module wraps the :class:`Socket` and :class:`Context` found in :mod:`pyzmq <zmq>` to be non blocking
|
||||
"""
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
__zmq__ = __import__('zmq')
|
||||
from eventlet import hubs
|
||||
from eventlet.patcher import slurp_properties
|
||||
|
@@ -1,3 +1,5 @@
|
||||
from __future__ import with_statement
|
||||
|
||||
from tests import LimitedTestCase, main, skip_with_pyevent, skip_if_no_itimer
|
||||
import time
|
||||
import eventlet
|
||||
|
@@ -1,3 +1,5 @@
|
||||
from __future__ import with_statement
|
||||
|
||||
from eventlet import event, spawn, sleep, patcher, semaphore
|
||||
from eventlet.hubs import get_hub, _threadlocal, use_hub
|
||||
from nose.tools import *
|
||||
|
10
tox.ini
10
tox.ini
@@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = py26,py27
|
||||
envlist = py25,py26,py27
|
||||
|
||||
[testenv]
|
||||
deps = nose
|
||||
@@ -9,6 +9,14 @@ commands =
|
||||
eventlet/pool.py eventlet/pools.py eventlet/proc.py \
|
||||
eventlet/queue.py eventlet/timeout.py
|
||||
|
||||
[testenv:py25selects]
|
||||
basepython = python2.5
|
||||
setenv = EVENTLET_HUB = selects
|
||||
|
||||
[testenv:py25poll]
|
||||
basepython = python2.5
|
||||
setenv = EVENTLET_HUB = poll
|
||||
|
||||
[testenv:py26selects]
|
||||
basepython = python2.6
|
||||
setenv = EVENTLET_HUB = selects
|
||||
|
Reference in New Issue
Block a user