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:
Gary Lin
2018-06-25 18:31:36 +08:00
committed by Yonghong Zhu
parent 0d1f5b2b5d
commit 86379ac48b
23 changed files with 59 additions and 67 deletions

View File

@ -25,7 +25,7 @@ import uuid
import GenC
import GenMake
import GenDepex
from StringIO import StringIO
from io import BytesIO
from StrGather import *
from BuildEngine import BuildRule
@ -3437,8 +3437,8 @@ class ModuleAutoGen(AutoGen):
def _GetAutoGenFileList(self):
UniStringAutoGenC = True
IdfStringAutoGenC = True
UniStringBinBuffer = StringIO()
IdfGenBinBuffer = StringIO()
UniStringBinBuffer = BytesIO()
IdfGenBinBuffer = BytesIO()
if self.BuildType == 'UEFI_HII':
UniStringAutoGenC = False
IdfStringAutoGenC = False
@ -3713,8 +3713,8 @@ class ModuleAutoGen(AutoGen):
except:
EdkLogger.error("build", FILE_OPEN_FAILURE, "File open failed for %s" % UniVfrOffsetFileName, None)
# Use a instance of StringIO to cache data
fStringIO = StringIO('')
# Use a instance of BytesIO to cache data
fStringIO = BytesIO('')
for Item in VfrUniOffsetList:
if (Item[0].find("Strings") != -1):