[edk2-devel] [PATCH 1/1] BaseTools: explicitly import decode_header PatchCheck.py

Liming Gao liming.gao at intel.com
Mon Apr 27 15:37:45 UTC 2020


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 at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Leif Lindholm
> Sent: Tuesday, April 21, 2020 11:42 PM
> To: devel at edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng at intel.com>; Gao, Liming <liming.gao at intel.com>
> 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 <bob.c.feng at intel.com>
> Cc: Liming Gao <liming.gao at intel.com>
> Signed-off-by: Leif Lindholm <leif at nuviainc.com>
> ---
> 
> 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
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58182): https://edk2.groups.io/g/devel/message/58182
Mute This Topic: https://groups.io/mt/73175129/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list