diff options
Diffstat (limited to 'core/core_builders.py')
-rw-r--r-- | core/core_builders.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/core/core_builders.py b/core/core_builders.py index a3dc935b79..0c161db364 100644 --- a/core/core_builders.py +++ b/core/core_builders.py @@ -53,6 +53,55 @@ def make_certs_header(target, source, env): g.write("#endif // CERTS_COMPRESSED_GEN_H") +def make_redot_authors_header(target, source, env): + sections = [ + "Project Founders", + "Lead Developer", + "Project Manager", + "Developers", + ] + sections_id = [ + "REDOT_AUTHORS_FOUNDERS", + "REDOT_AUTHORS_LEAD_DEVELOPERS", + "REDOT_AUTHORS_PROJECT_MANAGERS", + "REDOT_AUTHORS_DEVELOPERS", + ] + + src = str(source[0]) + dst = str(target[0]) + with open(src, "r", encoding="utf-8") as f, open(dst, "w", encoding="utf-8", newline="\n") as g: + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef REDOT_AUTHORS_GEN_H\n") + g.write("#define REDOT_AUTHORS_GEN_H\n") + + reading = False + + def close_section(): + g.write("\t0\n") + g.write("};\n") + + for line in f: + if reading: + if line.startswith(" "): + g.write('\t"' + escape_string(line.strip()) + '",\n') + continue + if line.startswith("## "): + if reading: + close_section() + reading = False + for section, section_id in zip(sections, sections_id): + if line.strip().endswith(section): + current_section = escape_string(section_id) + reading = True + g.write("const char *const " + current_section + "[] = {\n") + break + + if reading: + close_section() + + g.write("#endif // REDOT_AUTHORS_GEN_H\n") + + def make_authors_header(target, source, env): sections = [ "Project Founders", |