diff options
-rw-r--r-- | bitbake/lib/bb/utils.py | 7 | ||||
-rw-r--r-- | bitbake/lib/ply/yacc.py | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index e6e21e20fe..64a004d0d8 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -547,7 +547,12 @@ def md5_file(filename): | |||
547 | Return the hex string representation of the MD5 checksum of filename. | 547 | Return the hex string representation of the MD5 checksum of filename. |
548 | """ | 548 | """ |
549 | import hashlib | 549 | import hashlib |
550 | return _hasher(hashlib.new('MD5', usedforsecurity=False), filename) | 550 | try: |
551 | sig = hashlib.new('MD5', usedforsecurity=False) | ||
552 | except TypeError: | ||
553 | # Some configurations don't appear to support two arguments | ||
554 | sig = hashlib.new('MD5') | ||
555 | return _hasher(sig, filename) | ||
551 | 556 | ||
552 | def sha256_file(filename): | 557 | def sha256_file(filename): |
553 | """ | 558 | """ |
diff --git a/bitbake/lib/ply/yacc.py b/bitbake/lib/ply/yacc.py index 767c4e4674..381b50cf0b 100644 --- a/bitbake/lib/ply/yacc.py +++ b/bitbake/lib/ply/yacc.py | |||
@@ -2798,7 +2798,14 @@ class ParserReflect(object): | |||
2798 | def signature(self): | 2798 | def signature(self): |
2799 | try: | 2799 | try: |
2800 | import hashlib | 2800 | import hashlib |
2801 | except ImportError: | ||
2802 | raise RuntimeError("Unable to import hashlib") | ||
2803 | try: | ||
2801 | sig = hashlib.new('MD5', usedforsecurity=False) | 2804 | sig = hashlib.new('MD5', usedforsecurity=False) |
2805 | except TypeError: | ||
2806 | # Some configurations don't appear to support two arguments | ||
2807 | sig = hashlib.new('MD5') | ||
2808 | try: | ||
2802 | if self.start: | 2809 | if self.start: |
2803 | sig.update(self.start.encode('latin-1')) | 2810 | sig.update(self.start.encode('latin-1')) |
2804 | if self.prec: | 2811 | if self.prec: |