c_wrapper_generator.py: Migrated block-strings to fstrings.

Signed-off-by: Minos Galanakis <[email protected]>
This commit is contained in:
Minos Galanakis
2024-07-16 09:50:14 +01:00
parent fdb9b5b6c7
commit 4af4535931
@@ -67,25 +67,25 @@ class Base:
This includes a description comment and some include directives.
"""
prologue = textwrap.dedent("""
/* Automatically generated by generate_psa_wrappers.py, do not edit! */
prologue = textwrap.dedent(f'''
/* Automatically generated by {self.program_name}, do not edit! */
/* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
""").lstrip()
''').lstrip()
if header:
prologue += textwrap.dedent("""
#ifndef {guard}
#define {guard}
prologue += textwrap.dedent(f'''
#ifndef {self.header_guard}
#define {self.header_guard}
#ifdef __cplusplus
extern "C" {{
#endif
""".format(guard=self.header_guard)).lstrip()
''').lstrip()
for include in self._INCLUDES:
prologue += "#include {}\n".format(include)
@@ -100,14 +100,14 @@ class Base:
"""Write the epilogue of a C file."""
epilogue = ""
if header:
epilogue += textwrap.dedent("""
epilogue += textwrap.dedent(f'''
#ifdef __cplusplus
}}
#endif
#endif /* {guard} */
#endif /* {self.header_guard} */
""".format(guard=self.header_guard)).lstrip()
''').lstrip()
epilogue += ('/* End of automatically generated file. */\n')
out.write(epilogue)