From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.groups.io with SMTP id smtpd.web10.177.1588002967874995288 for ; Mon, 27 Apr 2020 08:56:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=hlBJ05VK; spf=pass (domain: nuviainc.com, ip: 209.85.221.49, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f49.google.com with SMTP id x18so21157928wrq.2 for ; Mon, 27 Apr 2020 08:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sI83W1Pg+hLCygiA33/Sq6XscmylN13iPVCQa8goyWE=; b=hlBJ05VKMUnv0uP53piFJyjaddDLQHeZueqPQGEmvL3UazS7JCwLZdvtlfcnFjanbV bBdA7bso2RPkvvSVB6iFfc/2yG4ICpLeG87egpUuphRPpDbHT8a8NQvRB/B7xOeLcNp/ +BZjjd9XzMaYit/8NQbpvuHPwV8EdoeFnRxGDmoqOJZaaoKkdYIkNDNKlQB0pnnxfFfn FxbL0QICuMjIYkIAPctJWUBShW8MgKfaZ1gS2bOC5i0y/2vYZfzlgKNJomyZWIOieCCm PBFHWsvB+4lk2SPF2pbsZypeqdAFOoEugcehEeNYvEuxfprGeYD21w+O3+a0lY7xBgFc BkTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sI83W1Pg+hLCygiA33/Sq6XscmylN13iPVCQa8goyWE=; b=mCrhn7vBxiRr0IF63HOmnwoIL5+IPJty+HgZQGq7IxVnJIK7WwDjT0QVPNS8ew3Am8 oEftmxU57YE/E0pnDvAVERPZBPnqVdwUCTkSFI/Cp752tuiwmWjYrROplG0N1HMXXPag j6nXyer/yHRD0/kVF7siV+j+IojeMagRs18kLCd1beAhuufiL9RST8rau9RFlqLqRTLn Dmgoj4/+S5XVaeGUyB4dX5myX+2MeQX7imfKBpEp+1cT3dudSUKRll/pUQu4u9IXSCOx jE/cArMDR1VGzBHteRjlIZvJVAYMFiaryBQpHqvK/1oIepzISDz2A79xfkaGOalKn6l9 YmFg== X-Gm-Message-State: AGi0PuZHrekM+Ys3SnsaH9ETLZdRb20ttokmCSOSml90Z0RzvQRylk2f bOK9vHcLPm61nwvA9plTwtRu2g== X-Google-Smtp-Source: APiQypJlEeDr4xJ2oVnvhx5Gx0zYRyoYoLtNffzAHpyuqt6b2NZ7Sn2bD5DxlyWwpq2H5gW//ZerTw== X-Received: by 2002:adf:ab1b:: with SMTP id q27mr30042712wrc.220.1588002966512; Mon, 27 Apr 2020 08:56:06 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id q17sm15361820wmj.45.2020.04.27.08.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 08:56:06 -0700 (PDT) Date: Mon, 27 Apr 2020 16:56:03 +0100 From: "Leif Lindholm" To: "Gao, Liming" Cc: "devel@edk2.groups.io" , "Feng, Bob C" Subject: Re: [edk2-devel] [PATCH 1/1] BaseTools: explicitly import decode_header PatchCheck.py Message-ID: <20200427155603.GT14075@vanye> References: <20200421154222.32485-1-leif@nuviainc.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Liming, Yes - this is part of https://docs.python.org/3/library/email.header.html (or for Python 2, https://docs.python.org/2/library/email.header.html). Someone with better python knowledge than me may be able to explain why the implicit import is required for Python 2 (at least in my setup) but not Python 3. / Leif On Mon, Apr 27, 2020 at 15:37:45 +0000, Gao, Liming wrote: > Lefi: > Is email.header built-in lib? If this change doesn't require user to install the additional python library, I am OK with change. > > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Leif Lindholm > > Sent: Tuesday, April 21, 2020 11:42 PM > > To: devel@edk2.groups.io > > Cc: Feng, Bob C ; Gao, Liming > > Subject: [edk2-devel] [PATCH 1/1] BaseTools: explicitly import decode_header PatchCheck.py > > > > On Debian 10 (Buster), when running PatchCheck.py with python2, a > > backtrace is printed, starting from: > > > > File "../edk2/BaseTools/Scripts/PatchCheck.py", line 595, in find_patch_pieces > > parts = email.header.decode_header(pmail.get('subject')) > > AttributeError: 'module' object has no attribute 'header' > > > > When using python3, this backtrace does not appear. > > > > Explicitly importing decode_header resolves this for python2 and does not > > appear to cause any issues with python3. > > > > Cc: Bob Feng > > Cc: Liming Gao > > Signed-off-by: Leif Lindholm > > --- > > > > I'm pretty sure this used to work with python 2, > > but I'm not sure when it stopped... > > > > BaseTools/Scripts/PatchCheck.py | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py > > index 13da6967785d..675ce273e830 100755 > > --- a/BaseTools/Scripts/PatchCheck.py > > +++ b/BaseTools/Scripts/PatchCheck.py > > @@ -19,6 +19,8 @@ import re > > import subprocess > > import sys > > > > +from email.header import decode_header > > + > > class Verbose: > > SILENT, ONELINE, NORMAL = range(3) > > level = NORMAL > > -- > > 2.20.1 > > > > > > >