BaseTools/Source/Python/Eot/EotMain.py | 8 ++++---- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
Because after Python 3.2, array.fromstring method is renamed frombytes,
so it needs to be modified to support python2 and python3 methods.
Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
BaseTools/Source/Python/Eot/EotMain.py | 8 ++++----
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/BaseTools/Source/Python/Eot/EotMain.py b/BaseTools/Source/Python/Eot/EotMain.py
index 791fcdfeae..2ff68054e6 100644
--- a/BaseTools/Source/Python/Eot/EotMain.py
+++ b/BaseTools/Source/Python/Eot/EotMain.py
@@ -152,11 +152,11 @@ class CompressedImage(Image):
try:
TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:])
DecData = array('B')
- DecData.fromstring(TmpData)
+ list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData))
except:
TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:])
DecData = array('B')
- DecData.fromstring(TmpData)
+ list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData))
SectionList = []
Offset = 0
@@ -738,7 +738,7 @@ class GuidDefinedImage(Image):
Offset = self.DataOffset - 4
TmpData = DeCompress('Framework', self[self.Offset:])
DecData = array('B')
- DecData.fromstring(TmpData)
+ list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData))
Offset = 0
while Offset < len(DecData):
Sec = Section()
@@ -759,7 +759,7 @@ class GuidDefinedImage(Image):
TmpData = DeCompress('Lzma', self[self.Offset:])
DecData = array('B')
- DecData.fromstring(TmpData)
+ list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData))
Offset = 0
while Offset < len(DecData):
Sec = Section()
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index dc1727c466..411af80c2b 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -463,7 +463,7 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
else:
SectionData = array('B', [0, 0, 0, 0])
- SectionData.fromstring(Ui.encode("utf_16_le"))
+ list(map(lambda str: SectionData.fromlist([ord(str), 0]), Ui))
SectionData.append(0)
SectionData.append(0)
Len = len(SectionData)
--
2.28.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66563): https://edk2.groups.io/g/devel/message/66563
Mute This Topic: https://groups.io/mt/77748883/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Array.tostring also should replace
-----邮件原件-----
发件人: bounce+27952+66563+5049190+8953120@groups.io <bounce+27952+66563+5049190+8953120@groups.io> 代表 mliang2x
发送时间: 2020年10月23日 11:02
收件人: devel@edk2.groups.io
抄送: Mingyue Liang <mingyuex.liang@intel.com>; Bob Feng <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com>
主题: [edk2-devel] [PATCH] BaseTools: replace array.fromstring Method for supports py-2 and py-3.
Because after Python 3.2, array.fromstring method is renamed frombytes,
so it needs to be modified to support python2 and python3 methods.
Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
BaseTools/Source/Python/Eot/EotMain.py | 8 ++++----
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/BaseTools/Source/Python/Eot/EotMain.py b/BaseTools/Source/Python/Eot/EotMain.py
index 791fcdfeae..2ff68054e6 100644
--- a/BaseTools/Source/Python/Eot/EotMain.py
+++ b/BaseTools/Source/Python/Eot/EotMain.py
@@ -152,11 +152,11 @@ class CompressedImage(Image):
try:
TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:])
DecData = array('B')
- DecData.fromstring(TmpData)
+ list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData))
except:
TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:])
DecData = array('B')
- DecData.fromstring(TmpData)
+ list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData))
SectionList = []
Offset = 0
@@ -738,7 +738,7 @@ class GuidDefinedImage(Image):
Offset = self.DataOffset - 4
TmpData = DeCompress('Framework', self[self.Offset:])
DecData = array('B')
- DecData.fromstring(TmpData)
+ list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData))
Offset = 0
while Offset < len(DecData):
Sec = Section()
@@ -759,7 +759,7 @@ class GuidDefinedImage(Image):
TmpData = DeCompress('Lzma', self[self.Offset:])
DecData = array('B')
- DecData.fromstring(TmpData)
+ list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData))
Offset = 0
while Offset < len(DecData):
Sec = Section()
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index dc1727c466..411af80c2b 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -463,7 +463,7 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
else:
SectionData = array('B', [0, 0, 0, 0])
- SectionData.fromstring(Ui.encode("utf_16_le"))
+ list(map(lambda str: SectionData.fromlist([ord(str), 0]), Ui))
SectionData.append(0)
SectionData.append(0)
Len = len(SectionData)
--
2.28.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66583): https://edk2.groups.io/g/devel/message/66583
Mute This Topic: https://groups.io/mt/77809034/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.