## @file\r
# generate capsule\r
#\r
-# Copyright (c) 2007-2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007-2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
import Ffs\r
from GenFdsGlobalVariable import GenFdsGlobalVariable\r
-import StringIO\r
+from io import BytesIO\r
from struct import pack\r
import os\r
from Common.Misc import SaveFileOnChange\r
# @param self The object pointer\r
def __init__(self):\r
pass\r
- \r
+\r
## generate capsule data\r
#\r
# @param self The object pointer\r
def GenCapsuleSubItem(self):\r
pass\r
- \r
+\r
## FFS class for capsule data\r
#\r
#\r
#\r
def GenCapsuleSubItem(self):\r
if self.FvName.find('.fv') == -1:\r
- if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
- FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
- FdBuffer = StringIO.StringIO('')\r
+ if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:\r
+ FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[self.FvName.upper()]\r
+ FdBuffer = BytesIO('')\r
FvObj.CapsuleName = self.CapsuleName\r
FvFile = FvObj.AddToBuffer(FdBuffer)\r
FvObj.CapsuleName = None\r
#\r
def GenCapsuleSubItem(self):\r
if self.FdName.find('.fd') == -1:\r
- if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
- FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
+ if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:\r
+ FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[self.FdName.upper()]\r
FdFile = FdObj.GenFd()\r
return FdFile\r
else:\r
FdFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FdName)\r
return FdFile\r
- \r
+\r
## AnyFile class for capsule data\r
#\r
#\r
#\r
def GenCapsuleSubItem(self):\r
return self.FileName\r
- \r
+\r
## Afile class for capsule data\r
#\r
#\r
#\r
Guid = self.ImageTypeId.split('-')\r
Buffer = pack('=ILHHBBBBBBBBBBBBIIQ',\r
- int(self.Version,16),\r
- int(Guid[0], 16), \r
- int(Guid[1], 16), \r
- int(Guid[2], 16), \r
- int(Guid[3][-4:-2], 16), \r
- int(Guid[3][-2:], 16), \r
+ int(self.Version, 16),\r
+ int(Guid[0], 16),\r
+ int(Guid[1], 16),\r
+ int(Guid[2], 16),\r
+ int(Guid[3][-4:-2], 16),\r
+ int(Guid[3][-2:], 16),\r
int(Guid[4][-12:-10], 16),\r
int(Guid[4][-10:-8], 16),\r
int(Guid[4][-8:-6], 16),\r