##\r
# Import Modules\r
#\r
+from __future__ import absolute_import\r
from . import Rule\r
import Common.LongFilePathOs as os\r
from io import BytesIO\r
if ImageObj.SectionAlignment < 0x400:\r
self.Alignment = str (ImageObj.SectionAlignment)\r
elif ImageObj.SectionAlignment < 0x100000:\r
- self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'\r
+ self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
else:\r
- self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'\r
+ self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'\r
\r
if not NoStrip:\r
FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
if ImageObj.SectionAlignment < 0x400:\r
self.Alignment = str (ImageObj.SectionAlignment)\r
elif ImageObj.SectionAlignment < 0x100000:\r
- self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'\r
+ self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
else:\r
- self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'\r
+ self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'\r
\r
if not NoStrip:\r
FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
def __GetBuildOutputMapFileVfrUniInfo(self, VfrUniBaseName):\r
MapFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".map")\r
EfiFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".efi")\r
- return GetVariableOffset(MapFileName, EfiFileName, list(VfrUniBaseName.values()))\r
+ return GetVariableOffset(MapFileName, EfiFileName, VfrUniBaseName.values())\r
\r
## __GenUniVfrOffsetFile() method\r
#\r
def __GenUniVfrOffsetFile(VfrUniOffsetList, UniVfrOffsetFileName):\r
\r
# Use a instance of StringIO to cache data\r
- fStringIO = BytesIO()\r
+ fStringIO = BytesIO('')\r
\r
for Item in VfrUniOffsetList:\r
if (Item[0].find("Strings") != -1):\r
# { 0x8913c5e0, 0x33f6, 0x4d86, { 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66 } }\r
#\r
UniGuid = [0xe0, 0xc5, 0x13, 0x89, 0xf6, 0x33, 0x86, 0x4d, 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66]\r
- fStringIO.write(bytes(UniGuid))\r
+ UniGuid = [chr(ItemGuid) for ItemGuid in UniGuid]\r
+ fStringIO.write(''.join(UniGuid))\r
UniValue = pack ('Q', int (Item[1], 16))\r
fStringIO.write (UniValue)\r
else:\r
# { 0xd0bc7cb4, 0x6a47, 0x495f, { 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2 } };\r
#\r
VfrGuid = [0xb4, 0x7c, 0xbc, 0xd0, 0x47, 0x6a, 0x5f, 0x49, 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2]\r
- fStringIO.write(bytes(VfrGuid))\r
+ VfrGuid = [chr(ItemGuid) for ItemGuid in VfrGuid]\r
+ fStringIO.write(''.join(VfrGuid))\r
type (Item[1])\r
VfrValue = pack ('Q', int (Item[1], 16))\r
fStringIO.write (VfrValue)\r