diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 22 |
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): | |||
538 | def sha256_file(filename): | 534 | def 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: |