audk/BaseTools/Source/Python/AutoGen
Cole Robinson 5d8648345c 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>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2020-08-14 02:21:18 +00:00
..
AutoGen.py BaseTools: Decouple AutoGen Objects 2019-08-09 23:15:52 +08:00
AutoGenWorker.py BaseTools: Move CreateAsBuiltInf into AutoGenWorker for parallel 2020-08-14 01:43:32 +00:00
BuildEngine.py BaseTools: Fix string concatenation 2020-07-02 10:09:17 +00:00
DataPipe.py BaseTools: Leverage compiler output to optimize binary cache 2019-12-10 02:07:12 +00:00
GenC.py BaseTools: remove unnecessary calls of os.exist 2019-09-17 10:19:05 +08:00
GenDepex.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
GenMake.py BaseTools: Generate multiple rules when multiple output files 2020-07-02 10:09:17 +00:00
GenPcdDb.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
GenVar.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
IdfClassObject.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
IncludesAutoGen.py BaseTools: Remove invalid leading space before !INCLUDE in Makefile 2020-03-02 02:36:25 +00:00
InfSectionParser.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
ModuleAutoGen.py BaseTools: Generate multiple rules when multiple output files 2020-07-02 10:09:17 +00:00
ModuleAutoGenHelper.py BaseTools: Fixed issue for IgnoreAutoGen 2019-09-10 08:39:18 +08:00
PlatformAutoGen.py BaseTools:GuidedSectionTools.txt is not generated correctly 2020-03-31 04:09:43 +00:00
StrGather.py BaseTools:Add extra debugging message 2019-08-01 15:36:48 +08:00
UniClassObject.py BaseTools: fix ucs-2 lookup on python 3.9 2020-08-14 02:21:18 +00:00
ValidCheckingInfoObject.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
WorkspaceAutoGen.py BaseTools: Add Guid name support in GenFfs. 2020-07-17 05:25:41 +00:00
__init__.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00