Include enum declarations into API hash calculation (fixes issue #3000)

This commit is contained in:
Dmitry Azaraev 2020-08-07 01:33:06 +03:00 committed by Marshall Greenblatt
parent 9e60357fc8
commit f89c0d74dd
1 changed files with 8 additions and 2 deletions

View File

@ -15,6 +15,12 @@ import time
import itertools import itertools
import hashlib 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: class cef_api_hash:
""" CEF API hash calculator """ """ CEF API hash calculator """
@ -145,7 +151,7 @@ class cef_api_hash:
# enums # enums
for m in re.finditer( 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()} object = {"name": m.group(1), "text": m.group(0).strip()}
objects.append(object) objects.append(object)
@ -225,7 +231,7 @@ class cef_api_hash:
outfile = os.path.join(self.__debugdir, filename) outfile = os.path.join(self.__debugdir, filename)
dir = os.path.dirname(outfile) dir = os.path.dirname(outfile)
make_dir(dir) make_dir(dir)
if not isinstance(content, basestring): if not isinstance(content, string_type):
content = "\n".join(content) content = "\n".join(content)
write_file(outfile, content) write_file(outfile, content)