From f6dcfea6fe0198c5afb7494c94d86ab53b8fe8a6 Mon Sep 17 00:00:00 2001 From: Johannes Dewender Date: Fri, 20 Apr 2012 11:53:59 +0200 Subject: [PATCH] fix contributor list sorting Two things were off: 1. sorting should be case-insensitive, in both places 2. multiple entries can be added just before the same line --- CONTRIBUTORS.rst | 14 +++++++------- contrib/contributors.py | 10 ++++++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 4f71190..ff8eb83 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -41,13 +41,13 @@ feature. * Albireo * arrai - * Kyle Brantley * asmodai - * but2002 * Mark Barnes + * Kyle Brantley + * but2002 * Eric Carr - * Carter Charbonneau * cbarber + * Carter Charbonneau * Alex Cline * Andrew Clunis * CounterPillow @@ -56,8 +56,8 @@ feature. * Ryan Finnie * Stephen Fluin * Pierre Guinoiseau - * Benjamin Herr * Lucas Hereld + * Benjamin Herr * Ryan Hitchman * Jenny * Michael Jensen @@ -68,16 +68,16 @@ feature. * Maciej Malecki * Ryan McCue * Zach McCullough - * Morlok8k * Mike - * Ryan Rector + * Morlok8k * Richard Pastrick + * Ryan Rector * Jason Scheirer * Gregory Short * Sam Steele * stoneLeaf * timwolla * TJ09 - * Jeffrey Warren * untergrundbiber * Philippe Villiers + * Jeffrey Warren diff --git a/contrib/contributors.py b/contrib/contributors.py index a066b74..73ee45b 100755 --- a/contrib/contributors.py +++ b/contrib/contributors.py @@ -82,7 +82,7 @@ def main(): for contributor in new_contributors: print format_contributor(contributor) - # merge with contributor list + # merge with alphabetical (by last part of name) contributor list i = 0 short_term_found = False for line in fileinput.input("CONTRIBUTORS.rst", inplace=1): @@ -94,10 +94,16 @@ def main(): if i >= len(new_contributors) or "@" not in line: print line, else: + listed_name = line.split()[-2].lower() contributor = new_contributors[i] - if line.split()[-2] > contributor["name"][-1]: + # insert all new contributors that fit here + while listed_name > contributor["name"][-1].lower(): print format_contributor(contributor) i += 1 + if i < len(new_contributors): + contributor = new_contributors[i] + else: + break print line, # append remaining contributors with open("CONTRIBUTORS.rst", "a") as contrib_file: