From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web11.11720.1575562378138535946 for ; Thu, 05 Dec 2019 08:12:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c3VBp9GS; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575562377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3X6A8sblr2vpsClTZdGMl97j9fAkzEERPy7sPkKiTio=; b=c3VBp9GSoMdbnbVyi3kUACZ3OgIsVKf3jxGXGal/ievB16YzDUTXxazzW0txdxI6kyeVAO pMYqEjPi5RNkZl1BYzLgcIZlADjeCw0cPbnJKubdwUPF+2WN1iXU66uAthaFtrjS18HUyd EgwVe2spDWzgcV/r9fbAZeqnM+hWMjo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-438-DML6iHKWOrWahEQnvCNs_A-1; Thu, 05 Dec 2019 11:12:53 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CEFCA18B5F8A; Thu, 5 Dec 2019 16:12:52 +0000 (UTC) Received: from x1w.redhat.com (ovpn-205-76.brq.redhat.com [10.40.205.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5655F10013D9; Thu, 5 Dec 2019 16:12:51 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Bob Feng , Liming Gao Subject: [PATCH 5/6] BaseTools/PatchCheck: Add printw() function to print warnings Date: Thu, 5 Dec 2019 17:12:33 +0100 Message-Id: <20191205161234.25071-6-philmd@redhat.com> In-Reply-To: <20191205161234.25071-1-philmd@redhat.com> References: <20191205161234.25071-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: DML6iHKWOrWahEQnvCNs_A-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Introduce printw() to print warnings. For now there are no logical change, we only call print(). Cc: Bob Feng Cc: Liming Gao Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index fc1b077f3c64..5692f6eaf8bd 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -28,6 +28,10 @@ def run_git(*args): Result =3D p.communicate() return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].= find(b"fatal") !=3D0 else None =20 +def printw(line): + """Print a warning to the console.""" + print(line) + class Verbose: SILENT, QUIET, ONELINE, NORMAL =3D range(4) level =3D NORMAL @@ -67,14 +71,14 @@ class CommitMessageCheck: =20 def error(self, *err): if self.ok and Verbose.level >=3D Verbose.QUIET: - print('The commit message format is not valid:') + printw('The commit message format is not valid:') self.ok =3D False if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count =3D 0 for line in err: prefix =3D (' *', ' ')[count > 0] - print(prefix, line) + printw("{}{}".format(prefix, line)) count +=3D 1 =20 # Find 'contributed-under:' at the start of a line ignoring case and @@ -415,14 +419,14 @@ class GitDiffCheck: =20 def error(self, *err): if self.ok and Verbose.level >=3D Verbose.QUIET: - print('Code format is not valid:') + printw('Code format is not valid:') self.ok =3D False if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count =3D 0 for line in err: prefix =3D (' *', ' ')[count > 0] - print(prefix, line) + printw("{}{}".format(prefix, line)) count +=3D 1 =20 class CheckOnePatch: --=20 2.21.0