]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: explicitly import email.header PatchCheck.py
authorLeif Lindholm <leif@nuviainc.com>
Thu, 2 Jul 2020 15:39:34 +0000 (23:39 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 3 Jul 2020 00:18:50 +0000 (00:18 +0000)
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 email.header resolves this for python2 and does not
appear to cause any issues with python3.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Scripts/PatchCheck.py

index 527761986d4ce4382601805288f793a148c12667..52244b0bc4d8d5d09c2f56348e63068b66b509df 100755 (executable)
@@ -20,6 +20,8 @@ import re
 import subprocess\r
 import sys\r
 \r
+import email.header\r
+\r
 class Verbose:\r
     SILENT, ONELINE, NORMAL = range(3)\r
     level = NORMAL\r