diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2021-09-16 10:59:12 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-09-24 12:09:46 -0400 |
commit | 9aab28b6f2c223912cc195833d1877ef70bfb5ba (patch) | |
tree | 0387b9ca8304c09c15119aedec14b66dab36be5b | |
parent | 8870daaa25feee6ab73ec2e52f731a19131cc314 (diff) | |
download | u-boot-9aab28b6f2c223912cc195833d1877ef70bfb5ba.zip u-boot-9aab28b6f2c223912cc195833d1877ef70bfb5ba.tar.gz u-boot-9aab28b6f2c223912cc195833d1877ef70bfb5ba.tar.bz2 |
scripts/mailmapper: enable running with Python 3
Our mailmapper script required Python 2 which is no longer maintained.
A main difference when converting to Python 3 is that byte strings are not
character strings. So add conversion and skip over conversion errors.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
-rwxr-xr-x | scripts/mailmapper | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/mailmapper b/scripts/mailmapper index 2e2d7fa..0e744ec 100755 --- a/scripts/mailmapper +++ b/scripts/mailmapper @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ # # Copyright (C) 2014, Masahiro Yamada <yamada.m@jp.panasonic.com> @@ -89,9 +89,10 @@ output = {} for line in shortlog.splitlines(): # tmp, mail = line.rsplit(None, 1) is not safe # because weird email addresses might include whitespaces - tmp, mail = line.split('<') - mail = '<' + mail.rstrip() try: + line = line.decode("utf-8") + tmp, mail = line.split('<') + mail = '<' + mail.rstrip() _, name = tmp.rstrip().split(None, 1) except ValueError: # author name is empty @@ -100,8 +101,11 @@ for line in shortlog.splitlines(): # another name for the same email address prev_name = mail_vs_name[mail] # Take the name with more commits - major_name = sorted([prev_name, name], - key=lambda x: commits_per_name[x] if x else 0)[1] + try: + major_name = sorted([prev_name, name], + key=lambda x: commits_per_name[x] if x else 0)[1] + except: + continue mail_vs_name[mail] = major_name if commits_per_name[major_name] > MIN_COMMITS: output[mail] = major_name |