From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web12.302.1597167131109162282 for ; Tue, 11 Aug 2020 10:32:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VqoJdAvK; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: crobinso@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597167130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+4t00MNbZdWTx+IWxR0voiND7yuJkrAr7LeaBm3wL4Y=; b=VqoJdAvKY2RHOEW8ng2s9QXCTq2PLW/BNUQsv6tLWL/fKn8VPNDUzE9y+Ay1dOwYYnilWi vjzeutk25XZLs58N4r+x35jmplzCJPSs2mD+PB4O885HWKuByHIz2Ui0aNoa79Vj9vNXkH GoflLPqNzJs65abPohnHtwCaYd0wJc4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-223-hFk-m0AlO5Sa7_Ah4__nIw-1; Tue, 11 Aug 2020 13:32:06 -0400 X-MC-Unique: hFk-m0AlO5Sa7_Ah4__nIw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D73B79EC2; Tue, 11 Aug 2020 17:32:04 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-118-49.rdu2.redhat.com [10.10.118.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A4BB10016E8; Tue, 11 Aug 2020 17:32:03 +0000 (UTC) From: "Cole" To: devel@edk2.groups.io Cc: bob.c.feng@intel.com, liming.gao@intel.com, Cole Robinson Subject: [PATCH 1/2] BaseTools: fix ucs-2 lookup on python 3.9 Date: Tue, 11 Aug 2020 13:28:17 -0400 Message-Id: <1ded5a5bfc3e3a83eba56fa0875db037e60a7c4e.1597166808.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crobinso@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D FAIL: testUtf16InUniFile (CheckUnicodeSourceFiles.Tests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Pytho= n/AutoGen/UniClassObject.py", line 375, in PreProcess FileIn =3D UniFileClassObject.OpenUniFile(LongFilePath(File.Path)) File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Pytho= n/AutoGen/UniClassObject.py", line 303, in OpenUniFile UniFileClassObject.VerifyUcs2Data(FileIn, FileName, Encoding) File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Pytho= n/AutoGen/UniClassObject.py", line 312, in VerifyUcs2Data Ucs2Info =3D codecs.lookup('ucs-2') LookupError: unknown encoding: ucs-2 Signed-off-by: Cole Robinson --- 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): =20=0D TheUcs2Codec =3D Ucs2Codec()=0D def Ucs2Search(name):=0D - if name =3D=3D 'ucs-2':=0D + if name in ['ucs-2', 'ucs_2']:=0D return codecs.CodecInfo(=0D name=3Dname,=0D encode=3DTheUcs2Codec.encode,=0D --=20 2.26.2