mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2024-12-29 09:21:19 +00:00
Check file content to see if it looks auto-generated
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
78064ac9e0
commit
2a9eb22107
@ -51,6 +51,12 @@ def list_generated_files() -> FrozenSet[str]:
|
||||
checks = re.findall(CHECK_CALL_RE, content)
|
||||
return frozenset(word for s in checks for word in s.split())
|
||||
|
||||
# Check for comment string indicating an auto-generated file
|
||||
AUTOGEN_RE = re.compile(r"Warning[ :-]+This file is (now )?auto[ -]generated", re.ASCII | re.IGNORECASE)
|
||||
def is_file_autogenerated(filename):
|
||||
content = open(filename, encoding="utf-8").read()
|
||||
return AUTOGEN_RE.search(content) is not None
|
||||
|
||||
def get_src_files(since: Optional[str]) -> List[str]:
|
||||
"""
|
||||
Use git to get a list of the source files.
|
||||
@ -85,7 +91,8 @@ def get_src_files(since: Optional[str]) -> List[str]:
|
||||
# generated files (we're correcting the templates instead).
|
||||
src_files = [filename for filename in src_files
|
||||
if not (filename.startswith("3rdparty/") or
|
||||
filename in generated_files)]
|
||||
filename in generated_files or
|
||||
is_file_autogenerated(filename))]
|
||||
return src_files
|
||||
|
||||
def get_uncrustify_version() -> str:
|
||||
|
Loading…
Reference in New Issue
Block a user