@@ -286,20 +286,9 @@ def purge(parsed_data, citations):
286
286
def generate_c_code (parsed_data ):
287
287
# Generate C code with an array of filenames and their
288
288
# corresponding INI sections.
289
- c_code = f"""// THIS FILE IS GENERATED AUTOMATICALLY! EDITS WILL BE LOST!
290
- // This file generated by { os .path .basename (sys .argv [0 ])}
289
+ c_code = "// THIS FILE IS GENERATED AUTOMATICALLY! EDITS WILL BE LOST!\n // This file generated by " + os .path .basename (sys .argv [0 ]) + "\n \n "
291
290
292
- """
293
- # Rather than escaping the C code {} in f strings, make this a
294
- # separate (non-f-string) addition to c_code.
295
- c_code += """#include "src/include/pmix_config.h"
296
-
297
- #include <stdio.h>
298
- #include <string.h>
299
-
300
- #include "src/include/pmix_globals.h"
301
-
302
- """
291
+ c_code += "#include \" src/include/pmix_config.h\" \n #include <stdio.h>\n #include <string.h>\n \n #include \" src/include/pmix_globals.h\" \n \n "
303
292
304
293
ini_arrays = []
305
294
file_entries = []
@@ -309,18 +298,18 @@ def generate_c_code(parsed_data):
309
298
310
299
ini_entries = []
311
300
for section , content_list in sections .items ():
312
- entry = f' {{ .topic = " { section } " ,\n .content = (const char *[]){{ \n '
301
+ entry = " { .topic = \" " + section + " \" ,\n .content = (const char *[]){\n "
313
302
for content in content_list :
314
303
c_content = content .replace ('"' ,'\\ "' ).replace ("\n " , '\\ n"\n "' ).replace ("\\ ;" , ";" )
315
- entry += f' \" { c_content } \" ,\n '
316
- entry += f' NULL}} \n }} ,\n '
304
+ entry += " \" " + c_content + " \" ,\n "
305
+ entry += " NULL}\n },\n "
317
306
ini_entries .append (entry )
318
- ini_entries .append (f' {{ .topic = NULL, .content = NULL }}' )
307
+ ini_entries .append (" { .topic = NULL, .content = NULL }" )
319
308
320
- ini_array_name = f "ini_entries_{ idx } "
321
- ini_arrays .append (f "static pmix_show_help_entry_t { ini_array_name } [] = { {\n " + "\n " .join (ini_entries ) + "\n };\n " )
322
- file_entries .append (f' {{ " { filename } ", { ini_array_name } }}' )
323
- file_entries .append (f' {{ NULL, NULL }}' )
309
+ ini_array_name = "ini_entries_" + str ( idx )
310
+ ini_arrays .append ("static pmix_show_help_entry_t " + ini_array_name + " [] = {\n " + "\n " .join (ini_entries ) + "\n };\n " )
311
+ file_entries .append (" { \" " + filename + " \" , " + ini_array_name + "}" )
312
+ file_entries .append (" { NULL, NULL }" )
324
313
325
314
c_code += "\n " .join (ini_arrays ) + "\n "
326
315
c_code += "pmix_show_help_file_t pmix_show_help_data[] = {\n " + ",\n " .join (file_entries ) + "\n };\n "
0 commit comments