[py3k] import queue using six.moves
authorRémi Cardona <remi.cardona@logilab.fr>
Tue, 15 Sep 2015 15:07:13 +0200
changeset 10608 7fc548d9dd8e
parent 10607 6519ae8cca0c
child 10609 e2d8e81bfe68
[py3k] import queue using six.moves
devtools/qunit.py
server/repository.py
--- a/devtools/qunit.py	Tue Sep 15 14:59:06 2015 +0200
+++ b/devtools/qunit.py	Tue Sep 15 15:07:13 2015 +0200
@@ -19,11 +19,12 @@
 import os, os.path as osp
 from tempfile import mkdtemp, NamedTemporaryFile, TemporaryFile
 import tempfile
-from Queue import Queue, Empty
 from subprocess import Popen, check_call, CalledProcessError
 from shutil import rmtree, copy as copyfile
 from uuid import uuid4
 
+from six.moves.queue import Queue, Empty
+
 # imported by default to simplify further import statements
 from logilab.common.testlib import unittest_main, with_tempdir, InnerTest, Tags
 from logilab.common.shellutils import getlogin
--- a/server/repository.py	Tue Sep 15 14:59:06 2015 +0200
+++ b/server/repository.py	Tue Sep 15 15:07:13 2015 +0200
@@ -30,12 +30,13 @@
 __docformat__ = "restructuredtext en"
 
 import threading
-import Queue
 from warnings import warn
 from itertools import chain
 from time import time, localtime, strftime
 from contextlib import contextmanager
 
+from six.moves import queue
+
 from logilab.common.decorators import cached, clear_cache
 from logilab.common.deprecation import deprecated
 
@@ -199,7 +200,7 @@
     def init_cnxset_pool(self):
         """should be called bootstrap_repository, as this is what it does"""
         config = self.config
-        self._cnxsets_pool = Queue.Queue()
+        self._cnxsets_pool = queue.Queue()
         # 0. init a cnxset that will be used to fetch bootstrap information from
         #    the database
         self._cnxsets_pool.put_nowait(self.system_source.wrapped_connection())
@@ -379,7 +380,7 @@
     def _get_cnxset(self):
         try:
             return self._cnxsets_pool.get(True, timeout=5)
-        except Queue.Empty:
+        except queue.Empty:
             raise Exception('no connections set available after 5 secs, probably either a '
                             'bug in code (too many uncommited/rolled back '
                             'connections) or too much load on the server (in '