Changeset - d6ccf6a9fd11
[Not reviewed]
default
0 1 0
Mads Kiilerich (mads) - 6 years ago 2020-03-28 15:29:58
mads@kiilerich.com
Grafted from: 19ed5bb68a18
scripts: fix crash from comparing integer with empty list

Fixed by using year 0 as default for contributors without any years.
1 file changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
scripts/update-copyrights.py
Show inline comments
 
@@ -52,10 +52,13 @@ def sortkey(x):
 
    * number of contribution years
 
    * name (with some unicode normalization)
 
    The entries must be 2-tuples of a list of string years and the name"""
 
    return (x[0] and -int(x[0][-1]),
 
            x[0] and int(x[0][0]),
 
            -len(x[0]),
 
            x[1].decode('utf-8').lower().replace('\xe9', 'e').replace('\u0142', 'l')
 
    years, name = x
 
    if not years:
 
        years = ['0']
 
    return (-int(years[-1]),  # primarily sort by latest contribution
 
            int(years[0]),  # then sort by first contribution
 
            -len(years),  # then sort by length of contribution (no gaps)
 
            name.lower().replace('\xe9', 'e').replace('\u0142', 'l')  # finally sort by name
 
        )
 

	
 

	
0 comments (0 inline, 0 general)