From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 255CCC433EF for ; Thu, 16 Sep 2021 08:59:58 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99EF561164 for ; Thu, 16 Sep 2021 08:59:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 99EF561164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 132238318E; Thu, 16 Sep 2021 10:59:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="c9eM5Fu4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0294182EE0; Thu, 16 Sep 2021 10:59:38 +0200 (CEST) Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D2CFF82F32 for ; Thu, 16 Sep 2021 10:59:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (unknown [46.253.247.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 562984017D; Thu, 16 Sep 2021 08:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1631782760; bh=D/G5Sr77Egohbq3t29rKsLiMEl8NMSXvo4MKvQBZweE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=c9eM5Fu4JQwVIbWVVO4knJtbfpl/IP//p/wSiuAzALF6pLozHmTzZzmIrzGg/Ikte d3MZPQVwLEZfu2nixZGSNpYZPUB6+WJGI8Uj8aKz+bu14GtEBPBrrjgA1n0b8Pk4x+ bexvEgLlnzitI/rqdsqmEt6cIS3DCv8L0rRmsrGRc/z0RMZAqhL3rGpYvY/MFVfo1L CJJLS2KFYL2Yw9bN585LezxvFMdGV8BG2o+MD7PyrwQeKmMk38Au3DqSnRkXEX7ZCj iLCiSvTkwgoFK6GyuvLpwsQ+EWwyoXLyP8EiuaniwQGnB4r0utwxpEFNCnbUsI80c3 UUfDZZ0I2VsBA== From: Heinrich Schuchardt To: Tom Rini Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/1] scripts/mailmapper: enable running with Python 3 Date: Thu, 16 Sep 2021 10:59:12 +0200 Message-Id: <20210916085912.52853-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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 --- scripts/mailmapper | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/mailmapper b/scripts/mailmapper index 2e2d7faff5..0e744ec1a0 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 @@ -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 -- 2.32.0