def announce(version):
<EOL>stdout = check_output(["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"])<EOL>stdout = stdout.decode("<STR_LIT:utf-8>")<EOL>last_version = stdout.strip()<EOL>stdout = check_output(<EOL>["<STR_LIT>", "<STR_LIT>", "<STR_LIT>".format(last_version), "<STR_LIT>"]<EOL>)<EOL>stdout = stdout.decode("<STR_LIT:utf-8>")<EOL>contributors = set(stdout.splitlines())<EOL>template_name = (<EOL>"<STR_LIT>" if version.endswith("<STR_LIT>") else "<STR_LIT>"<EOL>)<EOL>template_text = (<EOL>Path(__file__).parent.joinpath(template_name).read_text(encoding="<STR_LIT>")<EOL>)<EOL>contributors_text = (<EOL>"<STR_LIT:\n>".join("<STR_LIT>".format(name) for name in sorted(contributors)) + "<STR_LIT:\n>"<EOL>)<EOL>text = template_text.format(version=version, contributors=contributors_text)<EOL>target = Path(__file__).parent.joinpath(<EOL>"<STR_LIT>".format(version)<EOL>)<EOL>target.write_text(text, encoding="<STR_LIT>")<EOL>print(f"<STR_LIT>")<EOL>index_path = Path(__file__).parent.joinpath("<STR_LIT>")<EOL>lines = index_path.read_text(encoding="<STR_LIT>").splitlines()<EOL>indent = "<STR_LIT:U+0020>"<EOL>for index, line in enumerate(lines):<EOL><INDENT>if line.startswith("<STR_LIT>".format(indent)):<EOL><INDENT>new_line = indent + target.stem<EOL>if line != new_line:<EOL><INDENT>lines.insert(index, new_line)<EOL>index_path.write_text("<STR_LIT:\n>".join(lines) + "<STR_LIT:\n>", encoding="<STR_LIT>")<EOL>print(<EOL>f"<STR_LIT>"<EOL>)<EOL><DEDENT>else:<EOL><INDENT>print(<EOL>f"<STR_LIT>"<EOL>)<EOL><DEDENT>break<EOL><DEDENT><DEDENT>check_call(["<STR_LIT>", "<STR_LIT>", str(target)])<EOL>
Generates a new release announcement entry in the docs.