diff --git a/rhodecode/lib/compat.py b/rhodecode/lib/compat.py --- a/rhodecode/lib/compat.py +++ b/rhodecode/lib/compat.py @@ -407,6 +407,15 @@ except ImportError: #============================================================================== +# bytes +#============================================================================== +if __py_version__ >= (2, 6): + _bytes = bytes +else: + # in py2.6 bytes is a synonim for str + _bytes = str + +#============================================================================== # deque #============================================================================== @@ -416,11 +425,11 @@ else: #need to implement our own deque with maxlen class deque(object): - def __init__(self, iterable=(), maxlen=-1): + def __init__(self, iterable=(), maxlen= -1): if not hasattr(self, 'data'): self.left = self.right = 0 self.data = {} - self.maxlen = maxlen + self.maxlen = maxlen or -1 self.extend(iterable) def append(self, x): @@ -537,9 +546,9 @@ else: #============================================================================== if __py_version__ >= (2, 6): - from threading import Event + from threading import Event, Thread else: - from threading import _Verbose, Condition, Lock + from threading import _Verbose, Condition, Lock, Thread def Event(*args, **kwargs): return _Event(*args, **kwargs) diff --git a/rhodecode/lib/subprocessio.py b/rhodecode/lib/subprocessio.py --- a/rhodecode/lib/subprocessio.py +++ b/rhodecode/lib/subprocessio.py @@ -24,11 +24,10 @@ If not, see ccm: kr.clear() @@ -180,7 +180,7 @@ class BufferedGenerator(): self.worker.data_added.wait(0.2) if len(self.data): self.worker.keep_reading.set() - return bytes(self.data.popleft()) + return _bytes(self.data.popleft()) elif self.worker.EOF.is_set(): raise StopIteration diff --git a/rhodecode/tests/test_libs.py b/rhodecode/tests/test_libs.py --- a/rhodecode/tests/test_libs.py +++ b/rhodecode/tests/test_libs.py @@ -22,7 +22,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . - +from __future__ import with_statement import unittest import datetime import hashlib