Last active
August 10, 2021 17:23
-
-
Save siddhesh/15ea1f5e435ace9774f485030695ee02 to your computer and use it in GitHub Desktop.
Clean up raw CONTRIBUTED-BY output into something nicer looking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The raw CONTRIBUTED-BY file was generated by editing all files to remove the | |
# Contributed by lines and then running the following command: | |
# | |
# git diff -U1 | grep "^-" | sed -e 's/--- a\/\(.*\)/\1:/' -e 's/^-\(.*\)/\1\n/' >> CONTRIBUTED-BY | |
credit = {} | |
with open('CONTRIBUTED-BY', 'r') as contrfile: | |
curkey = '' | |
credit[''] = '' | |
for l in contrfile.readlines(): | |
if l[len(l) - 2] == ':': | |
curkey = l | |
credit[curkey] = '' | |
else: | |
l = l.strip('*%/ \t\n!#') | |
if l: | |
credit[curkey] = credit[curkey] + '\n ' + l | |
print(credit['']) | |
credit[''] = '' | |
for k in sorted(credit.keys()): | |
print(k.strip()) | |
print(" %s\n" % credit[k].strip()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment