Update authors file in place

Instead of having AUTHORS.src and copying that to a new AUTHORS
file with git log information appended to that have a single
AUHTORS file and update it in place with git log info.
This commit is contained in:
João Valverde 2023-01-20 10:51:10 +00:00
parent 597bcca9ee
commit 5f63989ee0
4 changed files with 18 additions and 4015 deletions

View File

@ -4514,6 +4514,7 @@ Jim Walker <jim[AT]couchbase.com>
Jim Young <jim.young.ws[AT]gmail.com>
Jim Young <jyoung[AT]gsu.edu>
Jiri Pirko <jiri[AT]resnulli.us>
Jiří Engelthaler <Jiri.Engelthaler[AT]zat.cz>
Jo Rueschel <wireshark[AT]rueschel.de>
Jo-Philipp Wich <jo[AT]mein.io>
Joakim Andersson <joakim.andersson[AT]nordicsemi.no>

File diff suppressed because it is too large Load Diff

View File

@ -4087,7 +4087,7 @@ if (GIT_EXECUTABLE)
# Update AUTHORS file with entries from git shortlog
add_custom_target(
gen-authors
COMMAND ${PYTHON_EXECUTABLE} tools/generate_authors.py AUTHORS.src > AUTHORS
COMMAND ${PYTHON_EXECUTABLE} tools/generate_authors.py AUTHORS
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
else (GIT_EXECUTABLE)

View File

@ -107,15 +107,23 @@ def generate_git_contributors_text(contributors_emails, git_authors_emails):
return "\n".join(output_lines)
def main():
stdoutu8 = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
# Read authos file until we find gitlog entries, then stop
def read_authors(parsed_args):
lines = []
with open(parsed_args.authors[0], 'r', encoding='utf-8') as fh:
for line in fh.readlines():
if '= From git log =' in line:
break
lines.append(line)
return ''.join(lines)
def main():
parser = argparse.ArgumentParser(description="Generate the AUTHORS file combining existing AUTHORS file with git commit log.")
parser.add_argument("authors", metavar='authors', nargs=1, help="path to AUTHORS file")
parsed_args = parser.parse_args()
with open(parsed_args.authors[0], encoding='utf-8') as fh:
author_content = fh.read()
author_content = read_authors(parsed_args)
# Collect the listed contributors emails so that we don't duplicate them
# in the listing of git contributors
@ -125,9 +133,11 @@ def main():
git_contributors_text = generate_git_contributors_text(contributors_emails, git_authors_emails)
# Now we can write our output:
git_contributor_header = '\n\n= From git log =\n\n'
git_contributor_header = '= From git log =\n\n'
output = author_content + git_contributor_header + git_contributors_text + '\n'
stdoutu8.write(output)
with open(parsed_args.authors[0], 'w', encoding='utf-8') as fh:
fh.write(output)
if __name__ == '__main__':