]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
prserv/persist_data/utils: Drop obsolete python2 imports
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 6 Jan 2017 12:35:08 +0000 (12:35 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 6 Jan 2017 12:35:12 +0000 (12:35 +0000)
These imports were from python 2.6 and earlier, 2.4 in some cases.
Drop them since we're all python3 now.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/persist_data.py
lib/bb/utils.py
lib/prserv/serv.py

index e6bbff88ea8a529b48fb06e629b0a4549c60fea7..bef7018614def01ddc4d78a54cbe34741f0e0be4 100644 (file)
@@ -28,11 +28,7 @@ import sys
 import warnings
 from bb.compat import total_ordering
 from collections import Mapping
-
-try:
-    import sqlite3
-except ImportError:
-    from pysqlite2 import dbapi2 as sqlite3
+import sqlite3
 
 sqlversion = sqlite3.sqlite_version_info
 if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
index a22a05e241471944d1b99587bbcd3f92390682ec..2845126293fdcb21c2c3c2f06b1f8883afb49e7f 100644 (file)
@@ -523,12 +523,8 @@ def md5_file(filename):
     """
     Return the hex string representation of the MD5 checksum of filename.
     """
-    try:
-        import hashlib
-        m = hashlib.md5()
-    except ImportError:
-        import md5
-        m = md5.new()
+    import hashlib
+    m = hashlib.md5()
 
     with open(filename, "rb") as f:
         for line in f:
@@ -538,14 +534,9 @@ def md5_file(filename):
 def sha256_file(filename):
     """
     Return the hex string representation of the 256-bit SHA checksum of
-    filename.  On Python 2.4 this will return None, so callers will need to
-    handle that by either skipping SHA checks, or running a standalone sha256sum
-    binary.
+    filename.
     """
-    try:
-        import hashlib
-    except ImportError:
-        return None
+    import hashlib
 
     s = hashlib.sha256()
     with open(filename, "rb") as f:
@@ -557,10 +548,7 @@ def sha1_file(filename):
     """
     Return the hex string representation of the SHA1 checksum of the filename
     """
-    try:
-        import hashlib
-    except ImportError:
-        return None
+    import hashlib
 
     s = hashlib.sha1()
     with open(filename, "rb") as f:
index d9b602f14c2b315fada89c16d7f8650d29f7b7e7..a7efa58bc765b466c27e7375646aac1e5a2e39b6 100644 (file)
@@ -5,12 +5,7 @@ import threading
 import queue
 import socket
 import io
-
-try:
-    import sqlite3
-except ImportError:
-    from pysqlite2 import dbapi2 as sqlite3
-
+import sqlite3
 import bb.server.xmlrpc
 import prserv
 import prserv.db