From 48ac1d640e30ec4bd0782da725c32eba49c91f17 Mon Sep 17 00:00:00 2001 From: Dmitry Azaraev Date: Fri, 7 Aug 2020 01:33:06 +0300 Subject: [PATCH] Include enum declarations into API hash calculation (fixes issue #3000) --- tools/cef_api_hash.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/cef_api_hash.py b/tools/cef_api_hash.py index 2ef623752..85b538d2f 100644 --- a/tools/cef_api_hash.py +++ b/tools/cef_api_hash.py @@ -15,6 +15,12 @@ import time import itertools import hashlib +# Determines string type for python 2 and python 3. +if sys.version_info[0] == 3: + string_type = str +else: + string_type = basestring + class cef_api_hash: """ CEF API hash calculator """ @@ -145,7 +151,7 @@ class cef_api_hash: # enums for m in re.finditer( - "\nenum\s+?(\w+)\s+?\{.*?\}\s*?;", content, flags=re.DOTALL): + "\ntypedef\s+?enum\s+?\{.*?\}\s+?(\w+)\s*?;", content, flags=re.DOTALL): object = {"name": m.group(1), "text": m.group(0).strip()} objects.append(object) @@ -225,7 +231,7 @@ class cef_api_hash: outfile = os.path.join(self.__debugdir, filename) dir = os.path.dirname(outfile) make_dir(dir) - if not isinstance(content, basestring): + if not isinstance(content, string_type): content = "\n".join(content) write_file(outfile, content)