summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/build
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2018-06-25 18:31:36 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-06-27 16:33:28 +0800
commit86379ac48ba17c71d4623c57099b064b15118e21 (patch)
tree9ec107c195a28a4bdcf9b4734fa2c20b8c07ce32 /BaseTools/Source/Python/build
parent0d1f5b2b5dc3c1cf381be0a1ec8f960dc6029a93 (diff)
downloadedk2-86379ac48ba17c71d4623c57099b064b15118e21.tar.gz
edk2-86379ac48ba17c71d4623c57099b064b15118e21.tar.bz2
edk2-86379ac48ba17c71d4623c57099b064b15118e21.zip
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>
Diffstat (limited to 'BaseTools/Source/Python/build')
-rw-r--r--BaseTools/Source/Python/build/BuildReport.py4
-rw-r--r--BaseTools/Source/Python/build/build.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index c9648a9299..897167cd11 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -28,7 +28,7 @@ import hashlib
import subprocess
import threading
from datetime import datetime
-from StringIO import StringIO
+from io import BytesIO
from Common import EdkLogger
from Common.Misc import SaveFileOnChange
from Common.Misc import GuidStructureByteArrayToGuidString
@@ -2169,7 +2169,7 @@ class BuildReport(object):
def GenerateReport(self, BuildDuration, AutoGenTime, MakeTime, GenFdsTime):
if self.ReportFile:
try:
- File = StringIO('')
+ File = BytesIO('')
for (Wa, MaList) in self.ReportList:
PlatformReport(Wa, MaList, self.ReportType).GenerateReport(File, BuildDuration, AutoGenTime, MakeTime, GenFdsTime, self.ReportType)
Content = FileLinesSplit(File.getvalue(), gLineMaxLength)
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index bf1f853d56..08e81016de 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -19,7 +19,7 @@
from __future__ import print_function
import Common.LongFilePathOs as os
import re
-import StringIO
+from io import BytesIO
import sys
import glob
import time
@@ -1782,7 +1782,7 @@ class Build():
if not Ma.IsLibrary:
ModuleList[Ma.Guid.upper()] = Ma
- MapBuffer = StringIO('')
+ MapBuffer = BytesIO('')
if self.LoadFixAddress != 0:
#
# Rebase module to the preferred memory address before GenFds
@@ -1940,7 +1940,7 @@ class Build():
if not Ma.IsLibrary:
ModuleList[Ma.Guid.upper()] = Ma
- MapBuffer = StringIO('')
+ MapBuffer = BytesIO('')
if self.LoadFixAddress != 0:
#
# Rebase module to the preferred memory address before GenFds
@@ -2127,7 +2127,7 @@ class Build():
#
# Rebase module to the preferred memory address before GenFds
#
- MapBuffer = StringIO('')
+ MapBuffer = BytesIO('')
if self.LoadFixAddress != 0:
self._CollectModuleMapBuffer(MapBuffer, ModuleList)