diff scripts/contributors.py @ 4828:64daaa4bf816

contributors.py: Exclude robots and change sorting so that among most recent contributors people with earlier entry date appear at the top. Add description to scripts/README.txt
author anatoly techtonik <techtonik@gmail.com>
date Sun, 25 Aug 2013 23:39:34 +0300
parents f1c7f99e6fc0
children 3fa026621f69
line wrap: on
line diff
--- a/scripts/contributors.py	Sun Aug 25 17:45:43 2013 +0300
+++ b/scripts/contributors.py	Sun Aug 25 23:39:34 2013 +0300
@@ -30,6 +30,7 @@
   'John P. Rouillard <rouilj@cs.umb.edu>':
       ['rouilj'],
 }
+ROBOTS = ['No Author <no-author@users.sourceforge.net>']
 # /-- 
 
 
@@ -93,11 +94,15 @@
   years = {}  # year -> set(author1, author2, ...)
   names = {}  # author -> set(years)
   for year, author in authorship:
+    if author in ROBOTS:
+      continue
     # process aliases
     for name, aliases in ALIASES.items():
       if author in aliases:
         author = name
         break
+    author = author.replace('<', '(')
+    author = author.replace('>', ')')
     # years
     if not year in years:
       years[year] = set()
@@ -134,13 +139,15 @@
     def year_cmp(name1, name2):
       """
       Year comparison function. First sort by latest contribution year (desc).
-      If it matches, compare first contribution year (desc).
+      If it matches, compare first contribution year (asc). This ensures that
+      the most recent and long-term contributors are at the top.
       """
       if last_year(name1) != last_year(name2):
         return last_year(name1) - last_year(name2)
       else:
-        return first_year(name1) - first_year(name2)
+        return first_year(name2) - first_year(name1)
     
+    print("Copyright (c)")
     for author in sorted(list(names), cmp=year_cmp, reverse=True):
       years = list(names[author])
       yearstr = compress(years)
@@ -148,5 +155,5 @@
       if 0: #DEBUG
         print(years, yearstr, author)
       else:
-        print("Copyright (c) %s %s" % (yearstr, author))
+        print("    %s %s" % (yearstr, author))
     print('')

Roundup Issue Tracker: http://roundup-tracker.org/