diff options
Diffstat (limited to 'bitbake/lib/ply/yacc.py')
-rw-r--r-- | bitbake/lib/ply/yacc.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bitbake/lib/ply/yacc.py b/bitbake/lib/ply/yacc.py index 46e7dc96f6..529f85b081 100644 --- a/bitbake/lib/ply/yacc.py +++ b/bitbake/lib/ply/yacc.py | |||
@@ -1122,7 +1122,6 @@ class LRParser: | |||
1122 | # manipulate the rules that make up a grammar. | 1122 | # manipulate the rules that make up a grammar. |
1123 | # ----------------------------------------------------------------------------- | 1123 | # ----------------------------------------------------------------------------- |
1124 | 1124 | ||
1125 | import re | ||
1126 | 1125 | ||
1127 | # regex matching identifiers | 1126 | # regex matching identifiers |
1128 | _is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$') | 1127 | _is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$') |
@@ -2797,11 +2796,15 @@ class ParserReflect(object): | |||
2797 | # Compute a signature over the grammar | 2796 | # Compute a signature over the grammar |
2798 | def signature(self): | 2797 | def signature(self): |
2799 | try: | 2798 | try: |
2800 | from hashlib import md5 | 2799 | import hashlib |
2801 | except ImportError: | 2800 | except ImportError: |
2802 | from md5 import md5 | 2801 | raise RuntimeError("Unable to import hashlib") |
2802 | try: | ||
2803 | sig = hashlib.new('MD5', usedforsecurity=False) | ||
2804 | except TypeError: | ||
2805 | # Some configurations don't appear to support two arguments | ||
2806 | sig = hashlib.new('MD5') | ||
2803 | try: | 2807 | try: |
2804 | sig = md5() | ||
2805 | if self.start: | 2808 | if self.start: |
2806 | sig.update(self.start.encode('latin-1')) | 2809 | sig.update(self.start.encode('latin-1')) |
2807 | if self.prec: | 2810 | if self.prec: |