[elbe-devel] [PATCH 1/4] Revert "Python3: change imports for python3 compatibility"
bage at linutronix.de
bage at linutronix.de
Fri Oct 2 19:46:17 CEST 2020
From: Bastian Germann <bage at linutronix.de>
This reverts commit cde271c60f27b05d035ac49de387ca6d4905c9fa
but uses the Python 3 version of the imports only.
Signed-off-by: Bastian Germann <bage at linutronix.de>
---
elbepack/asyncworker.py | 10 ++--------
elbepack/db.py | 5 +----
elbepack/rfs.py | 8 ++------
3 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
index b342de131..3d72fe88b 100644
--- a/elbepack/asyncworker.py
+++ b/elbepack/asyncworker.py
@@ -6,8 +6,10 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from threading import Thread
+from queue import Queue
from os import path, getcwd, chdir
from contextlib import contextmanager
+from urllib.parse import quote
import logging
from elbepack.db import get_versioned_filename
@@ -19,14 +21,6 @@ from elbepack.elbeproject import AptCacheCommitError, AptCacheUpdateError
from elbepack.shellhelper import do
from elbepack.log import elbe_logging, read_maxlevel, reset_level
-# pylint: disable=ungrouped-imports
-try:
- from Queue import Queue
- from urllib import quote
-except ImportError:
- from queue import Queue
- from urllib.parse import quote
-
# TODO:py3 Remove object inheritance
# pylint: disable=useless-object-inheritance
diff --git a/elbepack/db.py b/elbepack/db.py
index c9ac55892..682cfca7a 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -16,6 +16,7 @@ import glob
from datetime import datetime
from shutil import (rmtree, copyfile, copyfileobj)
from contextlib import contextmanager
+from urllib.parse import quote
from threading import Thread
from passlib.hash import pbkdf2_sha512
@@ -33,10 +34,6 @@ from sqlalchemy.exc import OperationalError
from elbepack.elbeproject import ElbeProject
from elbepack.elbexml import (ElbeXML, ValidationMode)
from elbepack.dosunix import dos2unix
-try:
- from urllib.parse import quote
-except ImportError:
- from urllib import quote
Base = declarative_base()
diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index 76a6485f8..e063d3282 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -8,6 +8,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import os
+import urllib
import logging
from elbepack.efilesystem import BuildImgFs
@@ -15,11 +16,6 @@ from elbepack.templates import (write_pack_template, get_preseed,
preseed_to_text)
from elbepack.shellhelper import CommandError, do, chroot, get_command_out
-try:
- from urlparse import urlsplit
-except ImportError:
- from urllib.parse import urlsplit
-
def create_apt_prefs(xml, rfs):
@@ -40,7 +36,7 @@ def create_apt_prefs(xml, rfs):
if 'pin' not in repo.et.attrib:
continue
- origin = urlsplit(repo.et.text.strip()).hostname
+ origin = urllib.parse.urlsplit(repo.et.text.strip()).hostname
pin = repo.et.attrib['pin']
if 'package' in repo.et.attrib:
package = repo.et.attrib['package']
--
2.28.0
More information about the elbe-devel
mailing list