From: "Bob Feng" <bob.c.feng@intel.com>
To: Cole Robinson <crobinso@redhat.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH 1/2] BaseTools: fix ucs-2 lookup on python 3.9
Date: Fri, 14 Aug 2020 01:20:22 +0000 [thread overview]
Message-ID: <DM6PR11MB407317DD33E6F20AA8C2672AC9400@DM6PR11MB4073.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1ded5a5bfc3e3a83eba56fa0875db037e60a7c4e.1597166808.git.crobinso@redhat.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-----Original Message-----
From: Cole Robinson <crobinso@redhat.com>
Sent: Wednesday, August 12, 2020 1:28 AM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Cole Robinson <crobinso@redhat.com>
Subject: [PATCH 1/2] BaseTools: fix ucs-2 lookup on python 3.9
python3.9 changed/fixed codec.register behavior to always replace hyphen with underscore for passed in codec names:
https://bugs.python.org/issue37751
So the custom Ucs2Search needs to be adapted to handle 'ucs_2' in addition to existing 'ucs-2' for back compat.
This fixes test failures on python3.9, example:
======================================================================
FAIL: testUtf16InUniFile (CheckUnicodeSourceFiles.Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Python/AutoGen/UniClassObject.py", line 375, in PreProcess
FileIn = UniFileClassObject.OpenUniFile(LongFilePath(File.Path))
File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Python/AutoGen/UniClassObject.py", line 303, in OpenUniFile
UniFileClassObject.VerifyUcs2Data(FileIn, FileName, Encoding)
File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Python/AutoGen/UniClassObject.py", line 312, in VerifyUcs2Data
Ucs2Info = codecs.lookup('ucs-2')
LookupError: unknown encoding: ucs-2
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
BaseTools/Source/Python/AutoGen/UniClassObject.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py
index b2895f7e5c..883c2356e0 100644
--- a/BaseTools/Source/Python/AutoGen/UniClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -152,7 +152,7 @@ class Ucs2Codec(codecs.Codec):
TheUcs2Codec = Ucs2Codec() def Ucs2Search(name):- if name == 'ucs-2':+ if name in ['ucs-2', 'ucs_2']: return codecs.CodecInfo( name=name, encode=TheUcs2Codec.encode,--
2.26.2
next prev parent reply other threads:[~2020-08-14 1:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 17:28 [PATCH 0/2] BaseTools: Python 3.9 fixes Cole
2020-08-11 17:28 ` [PATCH 1/2] BaseTools: fix ucs-2 lookup on python 3.9 Cole
2020-08-13 0:16 ` [edk2-devel] " Yuwei Chen
2020-08-14 1:20 ` Bob Feng [this message]
2020-08-11 17:28 ` [PATCH 2/2] BaseTools: Work around array.array.tostring() removal in " Cole
2020-08-13 0:16 ` [edk2-devel] " Yuwei Chen
2020-08-14 1:20 ` Bob Feng
2020-08-17 17:07 ` [edk2-devel] [PATCH 0/2] BaseTools: Python 3.9 fixes Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR11MB407317DD33E6F20AA8C2672AC9400@DM6PR11MB4073.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox