Skip to content

Commit 9f59cfd

Browse files
committed
ci(stm32wrapper): render files only once
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 6ba929e commit 9f59cfd

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

CI/update/stm32wrapper.py

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -219,39 +219,29 @@ def wrap(arg_core, arg_cmsis, log):
219219
else:
220220
ll_h_dict[peripheral] = [lower]
221221

222-
# Generate stm32yyxx_hal_*.c file
223-
for key, value in hal_c_dict.items():
224-
if key == "hal":
225-
filepath = HALoutSrc_path / c_file.replace("zz", "hal").replace(
226-
"_ppp", ""
227-
)
228-
else:
229-
filepath = HALoutSrc_path / c_file.replace("zz", "hal").replace(
230-
"ppp", key
231-
)
232-
out_file = open(filepath, "w", newline="\n")
233-
out_file.write(
234-
c_file_template.render(periph=key, type="hal", serieslist=value)
235-
)
236-
out_file.close()
237-
# Generate stm32yyxx_ll_*.c file
238-
for key, value in ll_c_dict.items():
239-
filepath = LLoutSrc_path / c_file.replace("zz", "ll").replace(
240-
"ppp", key
241-
)
242-
out_file = open(filepath, "w", newline="\n")
243-
out_file.write(
244-
c_file_template.render(periph=key, type="ll", serieslist=value)
245-
)
246-
out_file.close()
247-
# Generate stm32yyxx_ll_*.h file
248-
for key, value in ll_h_dict.items():
249-
filepath = LLoutInc_path / ll_h_file.replace("ppp", key)
250-
out_file = open(filepath, "w", newline="\n")
251-
out_file.write(ll_h_file_template.render(periph=key, serieslist=value))
252-
out_file.close()
253-
if log:
254-
print("done")
222+
# Generate stm32yyxx_hal_*.c file
223+
for key, value in hal_c_dict.items():
224+
if key == "hal":
225+
filepath = HALoutSrc_path / c_file.replace("zz", "hal").replace("_ppp", "")
226+
else:
227+
filepath = HALoutSrc_path / c_file.replace("zz", "hal").replace("ppp", key)
228+
out_file = open(filepath, "w", newline="\n")
229+
out_file.write(c_file_template.render(periph=key, type="hal", serieslist=value))
230+
out_file.close()
231+
# Generate stm32yyxx_ll_*.c file
232+
for key, value in ll_c_dict.items():
233+
filepath = LLoutSrc_path / c_file.replace("zz", "ll").replace("ppp", key)
234+
out_file = open(filepath, "w", newline="\n")
235+
out_file.write(c_file_template.render(periph=key, type="ll", serieslist=value))
236+
out_file.close()
237+
# Generate stm32yyxx_ll_*.h file
238+
for key, value in ll_h_dict.items():
239+
filepath = LLoutInc_path / ll_h_file.replace("ppp", key)
240+
out_file = open(filepath, "w", newline="\n")
241+
out_file.write(ll_h_file_template.render(periph=key, serieslist=value))
242+
out_file.close()
243+
if log:
244+
print("done")
255245

256246
# Filter all LL header file
257247
all_ll_h_list = sorted(set(all_ll_h_list))

0 commit comments

Comments
 (0)