Changeset - 27d6f56ade84
[Not reviewed]
stable
0 1 0
Mads Kiilerich - 6 years ago 2020-01-18 22:42:50
mads@kiilerich.com
Grafted from: b5b0e612e663
scripts: lower case contributor emails to normalize them
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
scripts/update-copyrights.py
Show inline comments
 
@@ -91,24 +91,27 @@ def insert_entries(
 
    all_entries: list of tuples with year and name
 
    no_entries: set of names or name and year tuples to ignore
 
    domain_extra: map domain name to extra credit name
 
    split_re: regexp matching the part of file to rewrite
 
    normalize_name: function to normalize names for grouping and display
 
    format_f: function formatting year list and name to a string
 
    """
 
    name_years = defaultdict(set)
 

	
 
    for year, name in all_entries:
 
        if name in no_entries or (name, year) in no_entries:
 
            continue
 
        parts = name.split(' <', 1)
 
        if len(parts) == 2:
 
            name = parts[0] + ' <' + parts[1].lower()
 
        domain = name.split('@', 1)[-1].rstrip('>')
 
        if domain in domain_extra:
 
            name_years[domain_extra[domain]].add(year)
 
        name_years[normalize_name(name)].add(year)
 

	
 
    l = [(list(sorted(year for year in years if year)), name)
 
         for name, years in name_years.items()]
 
    l.sort(key=sortkey)
 

	
 
    with open(filename) as f:
 
        pre, post = re.split(split_re, f.read())
 

	
0 comments (0 inline, 0 general)