##\r
# Import Modules\r
#\r
+from __future__ import absolute_import\r
from . import Ffs\r
from . import Rule\r
import Common.LongFilePathOs as os\r
Dict.update(self.DefineVarDict)\r
SectionAlignments = None\r
if self.FvName is not None :\r
- Buffer = BytesIO()\r
+ Buffer = BytesIO('')\r
if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict:\r
EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))\r
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
elif self.FileName is not None:\r
if hasattr(self, 'FvFileType') and self.FvFileType == 'RAW':\r
if isinstance(self.FileName, list) and isinstance(self.SubAlignment, list) and len(self.FileName) == len(self.SubAlignment):\r
- FileContent = BytesIO()\r
+ FileContent = ''\r
MaxAlignIndex = 0\r
MaxAlignValue = 1\r
for Index, File in enumerate(self.FileName):\r
if AlignValue > MaxAlignValue:\r
MaxAlignIndex = Index\r
MaxAlignValue = AlignValue\r
- FileContent.write(Content)\r
- if len(FileContent.getvalue()) % AlignValue != 0:\r
+ FileContent += Content\r
+ if len(FileContent) % AlignValue != 0:\r
Size = AlignValue - len(FileContent) % AlignValue\r
for i in range(0, Size):\r
- FileContent.write(pack('B', 0xFF))\r
+ FileContent += pack('B', 0xFF)\r
\r
- if FileContent.getvalue() != b'':\r
+ if FileContent:\r
OutputRAWFile = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid, self.NameGuid + '.raw')\r
- SaveFileOnChange(OutputRAWFile, FileContent.getvalue(), True)\r
+ SaveFileOnChange(OutputRAWFile, FileContent, True)\r
self.FileName = OutputRAWFile\r
self.SubAlignment = self.SubAlignment[MaxAlignIndex]\r
\r