BaseTools: Replace StringIO.StringIO with io.BytesIO
Replace StringIO.StringIO with io.BytesIO to be compatible with python3. This commit also removes "import StringIO" from those python scripts that don't really use it. Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@ -19,7 +19,7 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||
from CommonDataClass.FdfClass import CapsuleClassObject
|
||||
import Common.LongFilePathOs as os
|
||||
import subprocess
|
||||
import StringIO
|
||||
from io import BytesIO
|
||||
from Common.Misc import SaveFileOnChange
|
||||
from GenFds import GenFds
|
||||
from Common.Misc import PackRegistryFormatGuid
|
||||
@ -66,7 +66,7 @@ class Capsule (CapsuleClassObject) :
|
||||
# UINT32 CapsuleImageSize;
|
||||
# } EFI_CAPSULE_HEADER;
|
||||
#
|
||||
Header = StringIO.StringIO()
|
||||
Header = BytesIO()
|
||||
#
|
||||
# Use FMP capsule GUID: 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A
|
||||
#
|
||||
@ -97,7 +97,7 @@ class Capsule (CapsuleClassObject) :
|
||||
# // UINT64 ItemOffsetList[];
|
||||
# } EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER;
|
||||
#
|
||||
FwMgrHdr = StringIO.StringIO()
|
||||
FwMgrHdr = BytesIO()
|
||||
if 'CAPSULE_HEADER_INIT_VERSION' in self.TokensDict:
|
||||
FwMgrHdr.write(pack('=I', int(self.TokensDict['CAPSULE_HEADER_INIT_VERSION'], 16)))
|
||||
else:
|
||||
@ -132,7 +132,7 @@ class Capsule (CapsuleClassObject) :
|
||||
#
|
||||
|
||||
PreSize = FwMgrHdrSize
|
||||
Content = StringIO.StringIO()
|
||||
Content = BytesIO()
|
||||
for driver in self.CapsuleDataList:
|
||||
FileName = driver.GenCapsuleSubItem()
|
||||
FwMgrHdr.write(pack('=Q', PreSize))
|
||||
@ -247,7 +247,7 @@ class Capsule (CapsuleClassObject) :
|
||||
def GenCapInf(self):
|
||||
self.CapInfFileName = os.path.join(GenFdsGlobalVariable.FvDir,
|
||||
self.UiCapsuleName + "_Cap" + '.inf')
|
||||
CapInfFile = StringIO.StringIO() #open (self.CapInfFileName , 'w+')
|
||||
CapInfFile = BytesIO() #open (self.CapInfFileName , 'w+')
|
||||
|
||||
CapInfFile.writelines("[options]" + T_CHAR_LF)
|
||||
|
||||
|
Reference in New Issue
Block a user