From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web08.10885.1609749093533761078 for ; Mon, 04 Jan 2021 00:31:35 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Mon, 04 Jan 2021 16:31:29 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: "'Feng, Bob C'" , Cc: "'Chen, Christine'" , "'Liang, MingyueX'" References: <20201229121457.1066-1-bob.c.feng@intel.com> <000601d6e233$a6f5e2b0$f4e1a810$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0g5Zue5aSNOiBbUGF0Y2ggMS8xXSBCYXNlVG9vbHM6IEZpeCB0aGUgaXNzdWUgY2F1c2VkIGJ5IHRvc3RyaW5nKCkgcmVtb3ZhbCBvbiBQeTM5?= Date: Mon, 4 Jan 2021 16:31:30 +0800 Message-ID: <006301d6e274$007e01b0$017a0510$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQI0bIdVb7LpHYzyYhnCX6THhLH7mgKoK6vkAfO3WJ6pNy9xcA== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Original SaveFileOnChange() saves the file only when the file is updated. C= an this patch keep the same behavior? Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: Feng, Bob C > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B41=E6=9C=884=E6=97=A5 = 10:27 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; gaoliming@byosoft.com= .cn > =E6=8A=84=E9=80=81: Chen, Christine ; Liang, Mingy= ueX > > =E4=B8=BB=E9=A2=98: RE: [edk2-devel] =E5=9B=9E=E5=A4=8D: [Patch 1/1] Bas= eTools: Fix the issue caused by > tostring() removal on Py39 >=20 > Yes. it will always update .ui file. >=20 > Thanks, > Bob >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of gaoliming > Sent: Monday, January 4, 2021 8:51 AM > To: Feng, Bob C ; devel@edk2.groups.io > Cc: Chen, Christine ; Liang, MingyueX > > Subject: [edk2-devel] =E5=9B=9E=E5=A4=8D: [Patch 1/1] BaseTools: Fix the= issue caused by > tostring() removal on Py39 >=20 > Bob: >=20 > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > =E5=8F=91=E4=BB=B6=E4=BA=BA: Bob Feng > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B412=E6=9C=8829=E6=97= = =A5 20:15 > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > > =E6=8A=84=E9=80=81: Liming Gao ; Yuwei Chen > > ; Mingyue Liang > > =E4=B8=BB=E9=A2=98: [Patch 1/1] BaseTools: Fix the issue caused by tos= tring() removal > > on > > Py39 > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3136 > > > > Python 3.9 remove the array.array.tostring and > > array.array.fromstring() function. This patch is to use other method > > to replace tostring() and > > fromstring() > > > > Signed-off-by: Bob Feng > > > > Cc: Liming Gao > > Cc: Yuwei Chen > > Cc: Mingyue Liang > > --- > > .../Python/GenFds/GenFdsGlobalVariable.py | 23 > > ++++++++++++++++--- > > 1 file changed, 20 insertions(+), 3 deletions(-) > > > > diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > index dc1727c4666d..3019ec63c3bb 100644 > > --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > @@ -25,14 +25,15 @@ from Common.Misc import SaveFileOnChange > > > > from Common.TargetTxtClassObject import TargetTxtDict from > > Common.ToolDefClassObject import ToolDefDict from > AutoGen.BuildEngine > > import ToolBuildRule import Common.DataType as DataType -from > > Common.Misc import PathClass > > +from Common.Misc import PathClass,CreateDirectory > > from Common.LongFilePathSupport import OpenLongFilePath as open > from > > Common.MultipleWorkspace import MultipleWorkspace as mws import > > Common.GlobalData as GlobalData > > +from Common.BuildToolError import * > > > > ## Global variables > > # > > # > > class GenFdsGlobalVariable: > > @@ -461,16 +462,32 @@ class GenFdsGlobalVariable: > > Cmd +=3D ("-o", Output) > > if ' '.join(Cmd).strip() not in > > GenFdsGlobalVariable.SecCmdList: > > GenFdsGlobalVariable.SecCmdList.append(' > > '.join(Cmd).strip()) > > else: > > SectionData =3D array('B', [0, 0, 0, 0]) > > - SectionData.fromstring(Ui.encode("utf_16_le")) > > + > > SectionData.fromlist(array('B',Ui.encode('utf-16-le')).tolist()) > > SectionData.append(0) > > SectionData.append(0) > > Len =3D len(SectionData) > > > > GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & > > 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15) > > - SaveFileOnChange(Output, SectionData.tostring()) > > + > > + > > + DirName =3D os.path.dirname(Output) > > + if not CreateDirectory(DirName): > > + EdkLogger.error(None, FILE_CREATE_FAILURE, > > "Could not create directory %s" % DirName) > > + else: > > + if DirName =3D=3D '': > > + DirName =3D os.getcwd() > > + if not os.access(DirName, os.W_OK): > > + EdkLogger.error(None, > PERMISSION_FAILURE, > > "Do not have write permission on directory %s" % DirName) > > + > > + try: > > + with open(Output, "wb") as Fd: > > + SectionData.tofile(Fd) > > + Fd.flush() > > + except IOError as X: > > + EdkLogger.error(None, FILE_CREATE_FAILURE, > > ExtraData=3D'IOError %s' % X) >=20 > Does this change always update the file time stamp even if the file cont= ent is > not changed? >=20 > Thanks > Liming > > > > elif Ver: > > Cmd +=3D ("-n", Ver) > > if BuildNumber: > > Cmd +=3D ("-j", BuildNumber) > > -- > > 2.29.1.windows.1 >=20 >=20 >=20 >=20 >=20 >=20 >=20