summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-06 12:35:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-09 13:39:13 +0000
commit6f6f51783af0e45ebda4442e33c9de1a3932263c (patch)
treec0248477700bc8b46b65f3039edefdcde17d7f97 /bitbake/lib/bb/utils.py
parent949c7062b7b4d785e949d483fa46ada824442d53 (diff)
downloadpoky-6f6f51783af0e45ebda4442e33c9de1a3932263c.tar.gz
bitbake: prserv/persist_data/utils: Drop obsolete python2 imports
These imports were from python 2.6 and earlier, 2.4 in some cases. Drop them since we're all python3 now. (Bitbake rev: 7ef12684e8647b006bf46cae695069d4bfece1cf) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py22
1 files changed, 5 insertions, 17 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index a22a05e241..2845126293 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -523,12 +523,8 @@ def md5_file(filename):
523 """ 523 """
524 Return the hex string representation of the MD5 checksum of filename. 524 Return the hex string representation of the MD5 checksum of filename.
525 """ 525 """
526 try: 526 import hashlib
527 import hashlib 527 m = hashlib.md5()
528 m = hashlib.md5()
529 except ImportError:
530 import md5
531 m = md5.new()
532 528
533 with open(filename, "rb") as f: 529 with open(filename, "rb") as f:
534 for line in f: 530 for line in f:
@@ -538,14 +534,9 @@ def md5_file(filename):
538def sha256_file(filename): 534def sha256_file(filename):
539 """ 535 """
540 Return the hex string representation of the 256-bit SHA checksum of 536 Return the hex string representation of the 256-bit SHA checksum of
541 filename. On Python 2.4 this will return None, so callers will need to 537 filename.
542 handle that by either skipping SHA checks, or running a standalone sha256sum
543 binary.
544 """ 538 """
545 try: 539 import hashlib
546 import hashlib
547 except ImportError:
548 return None
549 540
550 s = hashlib.sha256() 541 s = hashlib.sha256()
551 with open(filename, "rb") as f: 542 with open(filename, "rb") as f:
@@ -557,10 +548,7 @@ def sha1_file(filename):
557 """ 548 """
558 Return the hex string representation of the SHA1 checksum of the filename 549 Return the hex string representation of the SHA1 checksum of the filename
559 """ 550 """
560 try: 551 import hashlib
561 import hashlib
562 except ImportError:
563 return None
564 552
565 s = hashlib.sha1() 553 s = hashlib.sha1()
566 with open(filename, "rb") as f: 554 with open(filename, "rb") as f: