[elbe-devel] [PATCH 08/10] be more robust about imports

Manuel Traut manut at linutronix.de
Fri Sep 29 00:11:44 CEST 2017


e.g. queue got renamed from python2.* to 3.x

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/asyncworker.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
index 95e91ce4..4af5f265 100644
--- a/elbepack/asyncworker.py
+++ b/elbepack/asyncworker.py
@@ -19,10 +19,20 @@
 from __future__ import print_function
 
 from threading import Thread
-from queue import Queue
+
+try:
+    from queue import Queue
+except ImportError:
+    from Queue import Queue
+
+try:
+    from urllib.parse import quote
+except ImportError:
+    from urllib import quote
+
+
 from os import path, getcwd, chdir
 from contextlib import contextmanager
-from urllib.parse import quote
 import traceback
 
 from elbepack.db import get_versioned_filename
-- 
2.14.1




More information about the elbe-devel mailing list