[edk2-devel] [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py

Leif Lindholm posted 2 patches 5 years, 7 months ago
[edk2-devel] [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py
Posted by Leif Lindholm 5 years, 7 months ago
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>
---
 BaseTools/Scripts/PatchCheck.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 527761986d4c..52244b0bc4d8 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -20,6 +20,8 @@ import re
 import subprocess
 import sys
 
+import email.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 (#61989): https://edk2.groups.io/g/devel/message/61989
Mute This Topic: https://groups.io/mt/75260901/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py
Posted by Bob Feng 5 years, 7 months ago
Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif Lindholm
Sent: Thursday, July 2, 2020 11:40 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [PATCH 2/2] BaseTools: explicitly import email.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 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>
---
 BaseTools/Scripts/PatchCheck.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 527761986d4c..52244b0bc4d8 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -20,6 +20,8 @@ import re
 import subprocess
 import sys
 
+import email.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 (#61990): https://edk2.groups.io/g/devel/message/61990
Mute This Topic: https://groups.io/mt/75260901/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-