mirror of
https://github.com/Ai-Thinker-Open/Ai-Thinker-Open_RTL8710BX_ALIOS_SDK.git
synced 2026-08-23 23:21:31 +00:00
build: tolerate legacy source encodings
This commit is contained in:
parent
27b3e2883d
commit
224b261537
1 changed files with 4 additions and 5 deletions
|
|
@ -44,8 +44,8 @@ def process_component_test(source_directory):
|
||||||
for root, dirs, files in chain.from_iterable(os.walk(path.strip()) for path in \
|
for root, dirs, files in chain.from_iterable(os.walk(path.strip()) for path in \
|
||||||
re.findall(location, config_mk_str)[0].split(":= ")[1:]):
|
re.findall(location, config_mk_str)[0].split(":= ")[1:]):
|
||||||
for source in [source for source in files if source.endswith(".c")]:
|
for source in [source for source in files if source.endswith(".c")]:
|
||||||
with open(os.path.join(root, source), "r") as head:
|
with open(os.path.join(root, source), "rb") as head:
|
||||||
codes = head.read()
|
codes = head.read().decode("utf-8", errors="ignore")
|
||||||
# find AOS_TESTCASE macro function
|
# find AOS_TESTCASE macro function
|
||||||
for code in re.findall("AOS_TESTCASE\s*\((.+\)\s*;)", codes):
|
for code in re.findall("AOS_TESTCASE\s*\((.+\)\s*;)", codes):
|
||||||
code_list.append(code[:len(code)-2])
|
code_list.append(code[:len(code)-2])
|
||||||
|
|
@ -94,8 +94,8 @@ def process_component_init(init_dir):
|
||||||
for root, dirs, files in chain.from_iterable(os.walk(path.strip()) for path in \
|
for root, dirs, files in chain.from_iterable(os.walk(path.strip()) for path in \
|
||||||
re.findall("AOS_SDK_INCLUDES\s+\+\=\s+(.+\n)", config_mk_str)[0].split("-I")[1:]):
|
re.findall("AOS_SDK_INCLUDES\s+\+\=\s+(.+\n)", config_mk_str)[0].split("-I")[1:]):
|
||||||
for include in [include for include in files if include.endswith(".h")]:
|
for include in [include for include in files if include.endswith(".h")]:
|
||||||
with open(os.path.join(root, include), "r") as head:
|
with open(os.path.join(root, include), "rb") as head:
|
||||||
code = head.read()
|
code = head.read().decode("utf-8", errors="ignore")
|
||||||
# find AOS_COMPONENT_INIT macro function
|
# find AOS_COMPONENT_INIT macro function
|
||||||
for init in re.findall("AOS_COMPONENT_INIT\s*\((.+\)\s*;)", code):
|
for init in re.findall("AOS_COMPONENT_INIT\s*\((.+\)\s*;)", code):
|
||||||
init_code = init.replace(',', '(', 1)
|
init_code = init.replace(',', '(', 1)
|
||||||
|
|
@ -125,4 +125,3 @@ if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue