## Import Modules\r
#\r
from __future__ import print_function\r
+from __future__ import absolute_import\r
import Common.LongFilePathOs as os\r
import re\r
import os.path as path\r
import copy\r
import uuid\r
\r
-import GenC\r
-import GenMake\r
-import GenDepex\r
-from StringIO import StringIO\r
+from . import GenC\r
+from . import GenMake\r
+from . import GenDepex\r
+from io import BytesIO\r
\r
-from StrGather import *\r
-from BuildEngine import BuildRule\r
+from .StrGather import *\r
+from .BuildEngine import BuildRule\r
\r
from Common.LongFilePathSupport import CopyLongFilePath\r
from Common.BuildToolError import *\r
from Workspace.BuildClassObject import *\r
from GenPatchPcdTable.GenPatchPcdTable import parsePcdInfoFromMapFile\r
import Common.VpdInfoFile as VpdInfoFile\r
-from GenPcdDb import CreatePcdDatabaseCode\r
+from .GenPcdDb import CreatePcdDatabaseCode\r
from Workspace.MetaFileCommentParser import UsageList\r
from Workspace.WorkspaceCommon import GetModuleLibInstances\r
from Common.MultipleWorkspace import MultipleWorkspace as mws\r
-import InfSectionParser\r
+from . import InfSectionParser\r
import datetime\r
import hashlib\r
-from GenVar import VariableMgr,var_info\r
+from .GenVar import VariableMgr, var_info\r
from collections import OrderedDict\r
from collections import defaultdict\r
from Workspace.WorkspaceCommon import OrderedListDict\r
super(WorkspaceAutoGen, self).__init__(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)\r
self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)\r
self._Init = True\r
- \r
+\r
## Initialize WorkspaceAutoGen\r
#\r
# @param WorkspaceDir Root directory of workspace\r
ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"\r
% (self.BuildTarget, " ".join(self.Platform.BuildTargets)))\r
\r
- \r
+\r
# parse FDF file to get PCDs in it, if any\r
if not self.FdfFile:\r
self.FdfFile = self.Platform.FlashDefinition\r
DecPcdsKey.add((Pcd[0], Pcd[1], Pcd[2]))\r
\r
Platform.SkuName = self.SkuId\r
- for Name, Guid in PcdSet:\r
+ for Name, Guid,Fileds in PcdSet:\r
if (Name, Guid) not in DecPcds:\r
EdkLogger.error(\r
'build',\r
if (Name, Guid, TAB_PCDS_FIXED_AT_BUILD) in DecPcdsKey \\r
or (Name, Guid, TAB_PCDS_PATCHABLE_IN_MODULE) in DecPcdsKey \\r
or (Name, Guid, TAB_PCDS_FEATURE_FLAG) in DecPcdsKey:\r
- Platform.AddPcd(Name, Guid, PcdSet[Name, Guid])\r
continue\r
elif (Name, Guid, TAB_PCDS_DYNAMIC) in DecPcdsKey or (Name, Guid, TAB_PCDS_DYNAMIC_EX) in DecPcdsKey:\r
EdkLogger.error(\r
#\r
self._CheckPcdDefineAndType()\r
\r
-# if self.FdfFile:\r
-# self._CheckDuplicateInFV(Fdf)\r
-\r
#\r
# Create BuildOptions Macro & PCD metafile, also add the Active Platform and FDF file.\r
#\r
\r
return AllWorkSpaceMetaFiles\r
\r
- ## _CheckDuplicateInFV() method\r
- #\r
- # Check whether there is duplicate modules/files exist in FV section. \r
- # The check base on the file GUID;\r
- #\r
- def _CheckDuplicateInFV(self, Fdf):\r
- for Fv in Fdf.Profile.FvDict:\r
- _GuidDict = {}\r
- for FfsFile in Fdf.Profile.FvDict[Fv].FfsList:\r
- if FfsFile.InfFileName and FfsFile.NameGuid is None:\r
- #\r
- # Get INF file GUID\r
- #\r
- InfFoundFlag = False\r
- for Pa in self.AutoGenObjectList:\r
- if InfFoundFlag:\r
- break\r
- for Module in Pa.ModuleAutoGenList:\r
- if path.normpath(Module.MetaFile.File) == path.normpath(FfsFile.InfFileName):\r
- InfFoundFlag = True\r
- if Module.Guid.upper() not in _GuidDict:\r
- _GuidDict[Module.Guid.upper()] = FfsFile\r
- break\r
- else:\r
- EdkLogger.error("build",\r
- FORMAT_INVALID,\r
- "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s" % (FfsFile.CurrentLineNum,\r
- FfsFile.CurrentLineContent,\r
- _GuidDict[Module.Guid.upper()].CurrentLineNum,\r
- _GuidDict[Module.Guid.upper()].CurrentLineContent,\r
- Module.Guid.upper()),\r
- ExtraData=self.FdfFile)\r
- #\r
- # Some INF files not have entity in DSC file. \r
- #\r
- if not InfFoundFlag:\r
- if FfsFile.InfFileName.find('$') == -1:\r
- InfPath = NormPath(FfsFile.InfFileName)\r
- if not os.path.exists(InfPath):\r
- EdkLogger.error('build', GENFDS_ERROR, "Non-existant Module %s !" % (FfsFile.InfFileName))\r
-\r
- PathClassObj = PathClass(FfsFile.InfFileName, self.WorkspaceDir)\r
- #\r
- # Here we just need to get FILE_GUID from INF file, use 'COMMON' as ARCH attribute. and use \r
- # BuildObject from one of AutoGenObjectList is enough.\r
- #\r
- InfObj = self.AutoGenObjectList[0].BuildDatabase.WorkspaceDb.BuildObject[PathClassObj, TAB_ARCH_COMMON, self.BuildTarget, self.ToolChain]\r
- if InfObj.Guid.upper() not in _GuidDict:\r
- _GuidDict[InfObj.Guid.upper()] = FfsFile\r
- else:\r
- EdkLogger.error("build",\r
- FORMAT_INVALID,\r
- "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s" % (FfsFile.CurrentLineNum,\r
- FfsFile.CurrentLineContent,\r
- _GuidDict[InfObj.Guid.upper()].CurrentLineNum,\r
- _GuidDict[InfObj.Guid.upper()].CurrentLineContent,\r
- InfObj.Guid.upper()),\r
- ExtraData=self.FdfFile)\r
- InfFoundFlag = False\r
-\r
- if FfsFile.NameGuid is not None:\r
- #\r
- # If the NameGuid reference a PCD name. \r
- # The style must match: PCD(xxxx.yyy)\r
- #\r
- if gPCDAsGuidPattern.match(FfsFile.NameGuid):\r
- #\r
- # Replace the PCD value.\r
- #\r
- _PcdName = FfsFile.NameGuid.lstrip("PCD(").rstrip(")")\r
- PcdFoundFlag = False\r
- for Pa in self.AutoGenObjectList:\r
- if not PcdFoundFlag:\r
- for PcdItem in Pa.AllPcdList:\r
- if (PcdItem.TokenSpaceGuidCName + "." + PcdItem.TokenCName) == _PcdName:\r
- #\r
- # First convert from CFormatGuid to GUID string\r
- #\r
- _PcdGuidString = GuidStructureStringToGuidString(PcdItem.DefaultValue)\r
-\r
- if not _PcdGuidString:\r
- #\r
- # Then try Byte array.\r
- #\r
- _PcdGuidString = GuidStructureByteArrayToGuidString(PcdItem.DefaultValue)\r
-\r
- if not _PcdGuidString:\r
- #\r
- # Not Byte array or CFormat GUID, raise error.\r
- #\r
- EdkLogger.error("build",\r
- FORMAT_INVALID,\r
- "The format of PCD value is incorrect. PCD: %s , Value: %s\n" % (_PcdName, PcdItem.DefaultValue),\r
- ExtraData=self.FdfFile)\r
-\r
- if _PcdGuidString.upper() not in _GuidDict:\r
- _GuidDict[_PcdGuidString.upper()] = FfsFile\r
- PcdFoundFlag = True\r
- break\r
- else:\r
- EdkLogger.error("build",\r
- FORMAT_INVALID,\r
- "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s" % (FfsFile.CurrentLineNum,\r
- FfsFile.CurrentLineContent,\r
- _GuidDict[_PcdGuidString.upper()].CurrentLineNum,\r
- _GuidDict[_PcdGuidString.upper()].CurrentLineContent,\r
- FfsFile.NameGuid.upper()),\r
- ExtraData=self.FdfFile)\r
-\r
- if FfsFile.NameGuid.upper() not in _GuidDict:\r
- _GuidDict[FfsFile.NameGuid.upper()] = FfsFile\r
- else:\r
- #\r
- # Two raw file GUID conflict.\r
- #\r
- EdkLogger.error("build",\r
- FORMAT_INVALID,\r
- "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s" % (FfsFile.CurrentLineNum,\r
- FfsFile.CurrentLineContent,\r
- _GuidDict[FfsFile.NameGuid.upper()].CurrentLineNum,\r
- _GuidDict[FfsFile.NameGuid.upper()].CurrentLineContent,\r
- FfsFile.NameGuid.upper()),\r
- ExtraData=self.FdfFile)\r
-\r
-\r
def _CheckPcdDefineAndType(self):\r
PcdTypeSet = {TAB_PCDS_FIXED_AT_BUILD,\r
TAB_PCDS_PATCHABLE_IN_MODULE,\r
for Pcd in Pa.Platform.Pcds:\r
PcdType = Pa.Platform.Pcds[Pcd].Type\r
\r
- # If no PCD type, this PCD comes from FDF \r
+ # If no PCD type, this PCD comes from FDF\r
if not PcdType:\r
continue\r
\r
## Check the PCDs token value conflict in each DEC file.\r
#\r
# Will cause build break and raise error message while two PCDs conflict.\r
- # \r
+ #\r
# @return None\r
#\r
def _CheckAllPcdsTokenValueConflict(self):\r
for Pa in self.AutoGenObjectList:\r
for Package in Pa.PackageList:\r
PcdList = Package.Pcds.values()\r
- PcdList.sort(lambda x, y: cmp(int(x.TokenValue, 0), int(y.TokenValue, 0))) \r
+ PcdList.sort(lambda x, y: cmp(int(x.TokenValue, 0), int(y.TokenValue, 0)))\r
Count = 0\r
while (Count < len(PcdList) - 1) :\r
Item = PcdList[Count]\r
self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch)\r
self._Init = True\r
#\r
- # Used to store all PCDs for both PEI and DXE phase, in order to generate \r
+ # Used to store all PCDs for both PEI and DXE phase, in order to generate\r
# correct PCD database\r
- # \r
+ #\r
_DynaPcdList_ = []\r
_NonDynaPcdList_ = []\r
_PlatformPcds = {}\r
- \r
+\r
#\r
- # The priority list while override build option \r
+ # The priority list while override build option\r
#\r
PrioList = {"0x11111" : 16, # TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE (Highest)\r
"0x01111" : 15, # ******_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE\r
"0x10111" : 14, # TARGET_*********_ARCH_COMMANDTYPE_ATTRIBUTE\r
- "0x00111" : 13, # ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE \r
+ "0x00111" : 13, # ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE\r
"0x11011" : 12, # TARGET_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE\r
"0x01011" : 11, # ******_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE\r
"0x10011" : 10, # TARGET_*********_****_COMMANDTYPE_ATTRIBUTE\r
#\r
def CollectFixedAtBuildPcds(self):\r
for LibAuto in self.LibraryAutoGenList:\r
- FixedAtBuildPcds = {} \r
- ShareFixedAtBuildPcdsSameValue = {} \r
- for Module in LibAuto._ReferenceModules: \r
- for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds:\r
- key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName)) \r
+ FixedAtBuildPcds = {}\r
+ ShareFixedAtBuildPcdsSameValue = {}\r
+ for Module in LibAuto._ReferenceModules:\r
+ for Pcd in set(Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds):\r
+ DefaultValue = Pcd.DefaultValue\r
+ # Cover the case: DSC component override the Pcd value and the Pcd only used in one Lib\r
+ if Pcd in Module.LibraryPcdList:\r
+ Index = Module.LibraryPcdList.index(Pcd)\r
+ DefaultValue = Module.LibraryPcdList[Index].DefaultValue\r
+ key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
if key not in FixedAtBuildPcds:\r
ShareFixedAtBuildPcdsSameValue[key] = True\r
- FixedAtBuildPcds[key] = Pcd.DefaultValue\r
+ FixedAtBuildPcds[key] = DefaultValue\r
else:\r
- if FixedAtBuildPcds[key] != Pcd.DefaultValue:\r
- ShareFixedAtBuildPcdsSameValue[key] = False \r
+ if FixedAtBuildPcds[key] != DefaultValue:\r
+ ShareFixedAtBuildPcdsSameValue[key] = False\r
for Pcd in LibAuto.FixedAtBuildPcds:\r
- key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))\r
- if (Pcd.TokenCName,Pcd.TokenSpaceGuidCName) not in self.NonDynamicPcdDict:\r
+ key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in self.NonDynamicPcdDict:\r
continue\r
else:\r
- DscPcd = self.NonDynamicPcdDict[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)]\r
+ DscPcd = self.NonDynamicPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)]\r
if DscPcd.Type != TAB_PCDS_FIXED_AT_BUILD:\r
continue\r
- if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]: \r
+ if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]:\r
LibAuto.ConstPcd[key] = FixedAtBuildPcds[key]\r
\r
def CollectVariables(self, DynamicPcdSet):\r
break\r
\r
\r
- VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(),self.DscBuildDataObj._GetSkuIds())\r
+ VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), self.DscBuildDataObj._GetSkuIds())\r
VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)\r
VariableInfo.SetVpdRegionOffset(VpdRegionBase)\r
Index = 0\r
for Pcd in DynamicPcdSet:\r
- pcdname = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))\r
+ pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
for SkuName in Pcd.SkuInfoList:\r
Sku = Pcd.SkuInfoList[SkuName]\r
SkuId = Sku.SkuId\r
VariableGuidStructure = Sku.VariableGuidValue\r
VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure)\r
for StorageName in Sku.DefaultStoreDict:\r
- VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableOffset, Sku.VariableAttribute , Sku.HiiDefaultValue,Sku.DefaultStoreDict[StorageName],Pcd.DatumType))\r
+ VariableInfo.append_variable(var_info(Index, pcdname, StorageName, SkuName, StringToArray(Sku.VariableName), VariableGuid, Sku.VariableOffset, Sku.VariableAttribute, Sku.HiiDefaultValue, Sku.DefaultStoreDict[StorageName], Pcd.DatumType))\r
Index += 1\r
return VariableInfo\r
\r
- def UpdateNVStoreMaxSize(self,OrgVpdFile):\r
+ def UpdateNVStoreMaxSize(self, OrgVpdFile):\r
if self.VariableInfo:\r
VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)\r
PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]\r
else:\r
EdkLogger.error("build", FILE_READ_FAILURE, "Can not find VPD map file %s to fix up VPD offset." % VpdMapFilePath)\r
\r
- NvStoreOffset = int(NvStoreOffset,16) if NvStoreOffset.upper().startswith("0X") else int(NvStoreOffset)\r
+ NvStoreOffset = int(NvStoreOffset, 16) if NvStoreOffset.upper().startswith("0X") else int(NvStoreOffset)\r
default_skuobj = PcdNvStoreDfBuffer[0].SkuInfoList.get(TAB_DEFAULT)\r
maxsize = self.VariableInfo.VpdRegionSize - NvStoreOffset if self.VariableInfo.VpdRegionSize else len(default_skuobj.DefaultValue.split(","))\r
var_data = self.VariableInfo.PatchNVStoreDefaultMaxSize(maxsize)\r
for F in self.Platform.Modules.keys():\r
M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile)\r
#GuidValue.update(M.Guids)\r
- \r
+\r
self.Platform.Modules[F].M = M\r
\r
for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:\r
if M.IsBinaryModule == True:\r
PcdFromModule.IsFromBinaryInf = True\r
\r
- # Check the PCD from DSC or not \r
+ # Check the PCD from DSC or not\r
PcdFromModule.IsFromDsc = (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds\r
\r
if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
if F.Path not in FdfModuleList:\r
- # If one of the Source built modules listed in the DSC is not listed \r
- # in FDF modules, and the INF lists a PCD can only use the PcdsDynamic \r
- # access method (it is only listed in the DEC file that declares the \r
+ # If one of the Source built modules listed in the DSC is not listed\r
+ # in FDF modules, and the INF lists a PCD can only use the PcdsDynamic\r
+ # access method (it is only listed in the DEC file that declares the\r
# PCD as PcdsDynamic), then build tool will report warning message\r
- # notify the PI that they are attempting to build a module that must \r
- # be included in a flash image in order to be functional. These Dynamic \r
- # PCD will not be added into the Database unless it is used by other \r
+ # notify the PI that they are attempting to build a module that must\r
+ # be included in a flash image in order to be functional. These Dynamic\r
+ # PCD will not be added into the Database unless it is used by other\r
# modules that are included in the FDF file.\r
if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET and \\r
PcdFromModule.IsFromBinaryInf == False:\r
# Print warning message to let the developer make a determine.\r
continue\r
- # If one of the Source built modules listed in the DSC is not listed in \r
- # FDF modules, and the INF lists a PCD can only use the PcdsDynamicEx \r
- # access method (it is only listed in the DEC file that declares the \r
- # PCD as PcdsDynamicEx), then DO NOT break the build; DO NOT add the \r
+ # If one of the Source built modules listed in the DSC is not listed in\r
+ # FDF modules, and the INF lists a PCD can only use the PcdsDynamicEx\r
+ # access method (it is only listed in the DEC file that declares the\r
+ # PCD as PcdsDynamicEx), then DO NOT break the build; DO NOT add the\r
# PCD to the Platform's PCD Database.\r
if PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
continue\r
PcdFromModule.Pending = False\r
self._NonDynaPcdList_.append (PcdFromModule)\r
DscModuleSet = {os.path.normpath(ModuleInf.Path) for ModuleInf in self.Platform.Modules}\r
- # add the PCD from modules that listed in FDF but not in DSC to Database \r
+ # add the PCD from modules that listed in FDF but not in DSC to Database\r
for InfName in FdfModuleList:\r
if InfName not in DscModuleSet:\r
InfClass = PathClass(InfName)\r
M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, self.ToolChain]\r
- # If a module INF in FDF but not in current arch's DSC module list, it must be module (either binary or source) \r
- # for different Arch. PCDs in source module for different Arch is already added before, so skip the source module here. \r
- # For binary module, if in current arch, we need to list the PCDs into database. \r
+ # If a module INF in FDF but not in current arch's DSC module list, it must be module (either binary or source)\r
+ # for different Arch. PCDs in source module for different Arch is already added before, so skip the source module here.\r
+ # For binary module, if in current arch, we need to list the PCDs into database.\r
if not M.IsSupportedArch:\r
continue\r
# Override the module PCD setting by platform setting\r
self._NonDynaPcdList_.append(PcdFromModule)\r
if PcdFromModule in self._DynaPcdList_ and PcdFromModule.Phase == 'PEI' and PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
# Overwrite the phase of any the same PCD existing, if Phase is PEI.\r
- # It is to solve the case that a dynamic PCD used by a PEM module/PEI \r
+ # It is to solve the case that a dynamic PCD used by a PEM module/PEI\r
# module & DXE module at a same time.\r
# Overwrite the type of the PCDs in source INF by the type of AsBuild\r
- # INF file as DynamicEx. \r
+ # INF file as DynamicEx.\r
Index = self._DynaPcdList_.index(PcdFromModule)\r
self._DynaPcdList_[Index].Phase = PcdFromModule.Phase\r
self._DynaPcdList_[Index].Type = PcdFromModule.Type\r
for PcdFromModule in self._NonDynaPcdList_:\r
- # If a PCD is not listed in the DSC file, but binary INF files used by \r
- # this platform all (that use this PCD) list the PCD in a [PatchPcds] \r
- # section, AND all source INF files used by this platform the build \r
- # that use the PCD list the PCD in either a [Pcds] or [PatchPcds] \r
+ # If a PCD is not listed in the DSC file, but binary INF files used by\r
+ # this platform all (that use this PCD) list the PCD in a [PatchPcds]\r
+ # section, AND all source INF files used by this platform the build\r
+ # that use the PCD list the PCD in either a [Pcds] or [PatchPcds]\r
# section, then the tools must NOT add the PCD to the Platform's PCD\r
- # Database; the build must assign the access method for this PCD as \r
+ # Database; the build must assign the access method for this PCD as\r
# PcdsPatchableInModule.\r
if PcdFromModule not in self._DynaPcdList_:\r
continue\r
self._DynamicPcdList = self._DynaPcdList_\r
#\r
# Sort dynamic PCD list to:\r
- # 1) If PCD's datum type is VOID* and value is unicode string which starts with L, the PCD item should \r
+ # 1) If PCD's datum type is VOID* and value is unicode string which starts with L, the PCD item should\r
# try to be put header of dynamicd List\r
# 2) If PCD is HII type, the PCD item should be put after unicode type PCD\r
#\r
if self._PlatformPcds[item].DatumType and self._PlatformPcds[item].DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
self._PlatformPcds[item].DatumType = TAB_VOID\r
\r
- if (self.Workspace.ArchList[-1] == self.Arch): \r
+ if (self.Workspace.ArchList[-1] == self.Arch):\r
for Pcd in self._DynamicPcdList:\r
# just pick the a value to determine whether is unicode string type\r
Sku = Pcd.SkuInfoList.values()[0]\r
VpdPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)] = Pcd\r
\r
#Collect DynamicHii PCD values and assign it to DynamicExVpd PCD gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer\r
- PcdNvStoreDfBuffer = VpdPcdDict.get(("PcdNvStoreDefaultValueBuffer","gEfiMdeModulePkgTokenSpaceGuid"))\r
+ PcdNvStoreDfBuffer = VpdPcdDict.get(("PcdNvStoreDefaultValueBuffer", "gEfiMdeModulePkgTokenSpaceGuid"))\r
if PcdNvStoreDfBuffer:\r
self.VariableInfo = self.CollectVariables(self._DynamicPcdList)\r
vardump = self.VariableInfo.dump()\r
PcdValue = DefaultSku.DefaultValue\r
if PcdValue not in SkuValueMap:\r
SkuValueMap[PcdValue] = []\r
- VpdFile.Add(Pcd, TAB_DEFAULT,DefaultSku.VpdOffset)\r
+ VpdFile.Add(Pcd, TAB_DEFAULT, DefaultSku.VpdOffset)\r
SkuValueMap[PcdValue].append(DefaultSku)\r
\r
- for (SkuName,Sku) in Pcd.SkuInfoList.items():\r
+ for (SkuName, Sku) in Pcd.SkuInfoList.items():\r
Sku.VpdOffset = Sku.VpdOffset.strip()\r
PcdValue = Sku.DefaultValue\r
if PcdValue == "":\r
EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))\r
if PcdValue not in SkuValueMap:\r
SkuValueMap[PcdValue] = []\r
- VpdFile.Add(Pcd, SkuName,Sku.VpdOffset)\r
+ VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)\r
SkuValueMap[PcdValue].append(Sku)\r
# if the offset of a VPD is *, then it need to be fixed up by third party tool.\r
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":\r
#\r
# Fix the PCDs define in VPD PCD section that never referenced by module.\r
# An example is PCD for signature usage.\r
- # \r
+ #\r
for DscPcd in PlatformPcds:\r
DscPcdEntry = self._PlatformPcds[DscPcd]\r
if DscPcdEntry.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:\r
SkuObjList = DscPcdEntry.SkuInfoList.items()\r
DefaultSku = DscPcdEntry.SkuInfoList.get(TAB_DEFAULT)\r
if DefaultSku:\r
- defaultindex = SkuObjList.index((TAB_DEFAULT,DefaultSku))\r
- SkuObjList[0],SkuObjList[defaultindex] = SkuObjList[defaultindex],SkuObjList[0]\r
- for (SkuName,Sku) in SkuObjList:\r
- Sku.VpdOffset = Sku.VpdOffset.strip() \r
- \r
+ defaultindex = SkuObjList.index((TAB_DEFAULT, DefaultSku))\r
+ SkuObjList[0], SkuObjList[defaultindex] = SkuObjList[defaultindex], SkuObjList[0]\r
+ for (SkuName, Sku) in SkuObjList:\r
+ Sku.VpdOffset = Sku.VpdOffset.strip()\r
+\r
# Need to iterate DEC pcd information to get the value & datumtype\r
for eachDec in self.PackageList:\r
for DecPcd in eachDec.Pcds:\r
EdkLogger.warn("build", "Unreferenced vpd pcd used!",\r
File=self.MetaFile, \\r
ExtraData = "PCD: %s.%s used in the DSC file %s is unreferenced." \\r
- %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, self.Platform.MetaFile.Path)) \r
- \r
+ %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, self.Platform.MetaFile.Path))\r
+\r
DscPcdEntry.DatumType = DecPcdEntry.DatumType\r
DscPcdEntry.DefaultValue = DecPcdEntry.DefaultValue\r
DscPcdEntry.TokenValue = DecPcdEntry.TokenValue\r
# Only fix the value while no value provided in DSC file.\r
if not Sku.DefaultValue:\r
DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue\r
- \r
+\r
if DscPcdEntry not in self._DynamicPcdList:\r
self._DynamicPcdList.append(DscPcdEntry)\r
Sku.VpdOffset = Sku.VpdOffset.strip()\r
EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment))\r
if PcdValue not in SkuValueMap:\r
SkuValueMap[PcdValue] = []\r
- VpdFile.Add(DscPcdEntry, SkuName,Sku.VpdOffset)\r
+ VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)\r
SkuValueMap[PcdValue].append(Sku)\r
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":\r
- NeedProcessVpdMapFile = True \r
+ NeedProcessVpdMapFile = True\r
if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):\r
UnicodePcdArray.add(DscPcdEntry)\r
elif len(Sku.VariableName) > 0:\r
VpdSkuMap[DscPcd] = SkuValueMap\r
if (self.Platform.FlashDefinition is None or self.Platform.FlashDefinition == '') and \\r
VpdFile.GetCount() != 0:\r
- EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, \r
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,\r
"Fail to get FLASH_DEFINITION definition in DSC file %s which is required when DSC contains VPD PCD." % str(self.Platform.MetaFile))\r
\r
if VpdFile.GetCount() != 0:\r
self._DynamicPcdList.extend(list(UnicodePcdArray))\r
self._DynamicPcdList.extend(list(HiiPcdArray))\r
self._DynamicPcdList.extend(list(OtherPcdArray))\r
- allskuset = [(SkuName,Sku.SkuId) for pcd in self._DynamicPcdList for (SkuName,Sku) in pcd.SkuInfoList.items()]\r
+ allskuset = [(SkuName, Sku.SkuId) for pcd in self._DynamicPcdList for (SkuName, Sku) in pcd.SkuInfoList.items()]\r
for pcd in self._DynamicPcdList:\r
if len(pcd.SkuInfoList) == 1:\r
- for (SkuName,SkuId) in allskuset:\r
- if type(SkuId) in (str,unicode) and eval(SkuId) == 0 or SkuId == 0:\r
+ for (SkuName, SkuId) in allskuset:\r
+ if type(SkuId) in (str, unicode) and eval(SkuId) == 0 or SkuId == 0:\r
continue\r
pcd.SkuInfoList[SkuName] = copy.deepcopy(pcd.SkuInfoList[TAB_DEFAULT])\r
pcd.SkuInfoList[SkuName].SkuId = SkuId\r
self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList\r
\r
- def FixVpdOffset(self,VpdFile ):\r
+ def FixVpdOffset(self, VpdFile ):\r
FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)\r
if not os.path.exists(FvPath):\r
try:\r
# retrieve BPDG tool's path from tool_def.txt according to VPD_TOOL_GUID defined in DSC file.\r
BPDGToolName = None\r
for ToolDef in self.ToolDefinition.values():\r
- if ToolDef.has_key(TAB_GUID) and ToolDef[TAB_GUID] == self.Platform.VpdToolGuid:\r
- if not ToolDef.has_key("PATH"):\r
+ if TAB_GUID in ToolDef and ToolDef[TAB_GUID] == self.Platform.VpdToolGuid:\r
+ if "PATH" not in ToolDef:\r
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % self.Platform.VpdToolGuid)\r
BPDGToolName = ToolDef["PATH"]\r
break\r
if self._NonDynamicPcdDict:\r
return self._NonDynamicPcdDict\r
for Pcd in self.NonDynamicPcdList:\r
- self._NonDynamicPcdDict[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)] = Pcd\r
+ self._NonDynamicPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)] = Pcd\r
return self._NonDynamicPcdDict\r
\r
## Get list of non-dynamic PCDs\r
self._PcdTokenNumber = OrderedDict()\r
TokenNumber = 1\r
#\r
- # Make the Dynamic and DynamicEx PCD use within different TokenNumber area. \r
+ # Make the Dynamic and DynamicEx PCD use within different TokenNumber area.\r
# Such as:\r
- # \r
+ #\r
# Dynamic PCD:\r
# TokenNumber 0 ~ 10\r
# DynamicEx PCD:\r
# @param Options Options to be expanded\r
#\r
# @retval options Options expanded\r
- # \r
+ #\r
def _ExpandBuildOption(self, Options, ModuleStyle=None):\r
BuildOptions = {}\r
FamilyMatch = False\r
if OverrideList.get(Key[1]) is not None:\r
OverrideList.pop(Key[1])\r
OverrideList[Key[1]] = Options[Key]\r
- \r
+\r
#\r
- # Use the highest priority value. \r
+ # Use the highest priority value.\r
#\r
if (len(OverrideList) >= 2):\r
KeyList = OverrideList.keys()\r
NextKey = KeyList[Index1 + Index + 1]\r
#\r
# Compare two Key, if one is included by another, choose the higher priority one\r
- # \r
+ #\r
Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_")\r
if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\\r
(ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*") and\\r
else:\r
if Options.get((self.BuildRuleFamily, NowKey)) is not None:\r
Options.pop((self.BuildRuleFamily, NowKey))\r
- \r
+\r
for Key in Options:\r
if ModuleStyle is not None and len (Key) > 2:\r
# Check Module style is EDK or EDKII.\r
% (MetaFile, Arch))\r
return None\r
return obj\r
- \r
+\r
## Initialize ModuleAutoGen\r
#\r
# @param Workspace EdkIIWorkspaceBuild object\r
\r
self.AutoGenDepSet = set()\r
\r
- \r
+\r
## The Modules referenced to this Library\r
# Only Library has this attribute\r
- self._ReferenceModules = [] \r
- \r
+ self._ReferenceModules = []\r
+\r
## Store the FixedAtBuild Pcds\r
- # \r
+ #\r
self._FixedAtBuildPcds = []\r
self.ConstPcd = {}\r
\r
+ ##Store the VOID* type FixedAtBuild Pcds\r
+ #\r
+ self._FixedPcdVoidTypeDict = {}\r
+\r
def __repr__(self):\r
return "%s [%s]" % (self.MetaFile, self.Arch)\r
\r
continue\r
if Pcd not in self._FixedAtBuildPcds:\r
self._FixedAtBuildPcds.append(Pcd)\r
- \r
- return self._FixedAtBuildPcds \r
+\r
+ return self._FixedAtBuildPcds\r
+\r
+ def _GetFixedAtBuildVoidTypePcds(self):\r
+ if self._FixedPcdVoidTypeDict:\r
+ return self._FixedPcdVoidTypeDict\r
+ for Pcd in self.ModulePcdList:\r
+ if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType == TAB_VOID:\r
+ if '{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName) not in self._FixedPcdVoidTypeDict:\r
+ self._FixedPcdVoidTypeDict['{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)] = Pcd.DefaultValue\r
+ return self._FixedPcdVoidTypeDict\r
\r
def _GetUniqueBaseName(self):\r
BaseName = self.Name\r
self._Macro = OrderedDict()\r
self._Macro["WORKSPACE" ] = self.WorkspaceDir\r
self._Macro["MODULE_NAME" ] = self.Name\r
- self._Macro["MODULE_NAME_GUID" ] = self._GetUniqueBaseName()\r
+ self._Macro["MODULE_NAME_GUID" ] = self.UniqueBaseName\r
self._Macro["MODULE_GUID" ] = self.Guid\r
self._Macro["MODULE_VERSION" ] = self.Version\r
self._Macro["MODULE_TYPE" ] = self.ModuleType\r
continue\r
PackageList.append(Package)\r
return PackageList\r
- \r
+\r
## Get the depex string\r
#\r
# @return : a string contain all depex expresion.\r
(Arch.upper() == self.Arch.upper() and \\r
ModuleType.upper() in [TAB_ARCH_COMMON, self.ModuleType.upper()]):\r
DepexList.append({(Arch, ModuleType): DepexExpr})\r
- \r
+\r
#the type of build module is USER_DEFINED.\r
if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:\r
for Depex in DepexList:\r
if not DepexStr:\r
return '[Depex.%s]\n' % self.Arch\r
return DepexStr\r
- \r
+\r
#the type of build module not is USER_DEFINED.\r
Count = 0\r
for Depex in DepexList:\r
if not DepexStr:\r
return '[Depex.%s]\n' % self.Arch\r
return '[Depex.%s]\n# ' % self.Arch + DepexStr\r
- \r
+\r
## Merge dependency expression\r
#\r
# @retval list The token list of the dependency expression after parsed\r
return self._DepexDict\r
\r
self._DepexDict[self.ModuleType] = []\r
-\r
+ self._GetFixedAtBuildVoidTypePcds()\r
for ModuleType in self._DepexDict:\r
DepexList = self._DepexDict[ModuleType]\r
#\r
if DepexList != []:\r
DepexList.append('AND')\r
DepexList.append('(')\r
- DepexList.extend(D)\r
+ #replace D with value if D is FixedAtBuild PCD\r
+ NewList = []\r
+ for item in D:\r
+ if '.' not in item:\r
+ NewList.append(item)\r
+ else:\r
+ if item not in self._FixedPcdVoidTypeDict:\r
+ EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item))\r
+ else:\r
+ Value = self._FixedPcdVoidTypeDict[item]\r
+ if len(Value.split(',')) != 16:\r
+ EdkLogger.error("build", FORMAT_INVALID,\r
+ "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item))\r
+ NewList.append(Value)\r
+ DepexList.extend(NewList)\r
if DepexList[-1] == 'END': # no need of a END at this time\r
DepexList.pop()\r
DepexList.append(')')\r
#\r
self._BuildOptionIncPathList = []\r
return self._BuildOptionIncPathList\r
- \r
+\r
BuildOptionIncPathList = []\r
for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):\r
try:\r
FlagOption = self.BuildOption[Tool]['FLAGS']\r
except KeyError:\r
FlagOption = ''\r
- \r
+\r
if self.PlatformInfo.ToolChainFamily != 'RVCT':\r
IncPathList = [NormPath(Path, self.Macros) for Path in BuildOptIncludeRegEx.findall(FlagOption)]\r
else:\r
IncPathList.extend(NormPath(PathEntry, self.Macros) for PathEntry in PathList)\r
\r
#\r
- # EDK II modules must not reference header files outside of the packages they depend on or \r
+ # EDK II modules must not reference header files outside of the packages they depend on or\r
# within the module's directory tree. Report error if violation.\r
#\r
if self.AutoGenVersion >= 0x00010005:\r
ExtraData=ErrMsg,\r
File=str(self.MetaFile))\r
\r
- \r
+\r
BuildOptionIncPathList += IncPathList\r
- \r
+\r
self._BuildOptionIncPathList = BuildOptionIncPathList\r
- \r
+\r
return self._BuildOptionIncPathList\r
- \r
+\r
## Return a list of files which can be built from source\r
#\r
# What kind of files can be built is determined by build rules in\r
def _GetSourceFileList(self):\r
if self._SourceFileList is None:\r
self._SourceFileList = []\r
+ ToolChainTagSet = {"", "*", self.ToolChain}\r
+ ToolChainFamilySet = {"", "*", self.ToolChainFamily, self.BuildRuleFamily}\r
for F in self.Module.Sources:\r
# match tool chain\r
- if F.TagName not in ("", "*", self.ToolChain):\r
+ if F.TagName not in ToolChainTagSet:\r
EdkLogger.debug(EdkLogger.DEBUG_9, "The toolchain [%s] for processing file [%s] is found, "\r
- "but [%s] is needed" % (F.TagName, str(F), self.ToolChain))\r
+ "but [%s] is currently used" % (F.TagName, str(F), self.ToolChain))\r
continue\r
# match tool chain family or build rule family\r
- if F.ToolChainFamily not in ("", "*", self.ToolChainFamily, self.BuildRuleFamily):\r
+ if F.ToolChainFamily not in ToolChainFamilySet:\r
EdkLogger.debug(\r
EdkLogger.DEBUG_0,\r
"The file [%s] must be built by tools of [%s], " \\r
Order_Dict[F].sort(key=lambda i: self.BuildRuleOrder.index(i))\r
for Ext in Order_Dict[F][1:]:\r
RemoveList.append(F + Ext)\r
- \r
+\r
for item in RemoveList:\r
FileList.remove(item)\r
\r
def _GetAutoGenFileList(self):\r
UniStringAutoGenC = True\r
IdfStringAutoGenC = True\r
- UniStringBinBuffer = StringIO()\r
- IdfGenBinBuffer = StringIO()\r
+ UniStringBinBuffer = BytesIO()\r
+ IdfGenBinBuffer = BytesIO()\r
if self.BuildType == 'UEFI_HII':\r
UniStringAutoGenC = False\r
IdfStringAutoGenC = False\r
for SourceFile in self.Module.Sources:\r
if SourceFile.Type.upper() == ".VFR" :\r
#\r
- # search the .map file to find the offset of vfr binary in the PE32+/TE file. \r
+ # search the .map file to find the offset of vfr binary in the PE32+/TE file.\r
#\r
VfrUniBaseName[SourceFile.BaseName] = (SourceFile.BaseName + "Bin")\r
elif SourceFile.Type.upper() == ".UNI" :\r
#\r
- # search the .map file to find the offset of Uni strings binary in the PE32+/TE file. \r
+ # search the .map file to find the offset of Uni strings binary in the PE32+/TE file.\r
#\r
VfrUniBaseName["UniOffsetName"] = (self.Name + "Strings")\r
\r
try:\r
fInputfile = open(UniVfrOffsetFileName, "wb+", 0)\r
except:\r
- EdkLogger.error("build", FILE_OPEN_FAILURE, "File open failed for %s" % UniVfrOffsetFileName,None)\r
+ EdkLogger.error("build", FILE_OPEN_FAILURE, "File open failed for %s" % UniVfrOffsetFileName, None)\r
\r
- # Use a instance of StringIO to cache data\r
- fStringIO = StringIO('') \r
+ # Use a instance of BytesIO to cache data\r
+ fStringIO = BytesIO('')\r
\r
for Item in VfrUniOffsetList:\r
if (Item[0].find("Strings") != -1):\r
#\r
UniGuid = [0xe0, 0xc5, 0x13, 0x89, 0xf6, 0x33, 0x86, 0x4d, 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66]\r
UniGuid = [chr(ItemGuid) for ItemGuid in UniGuid]\r
- fStringIO.write(''.join(UniGuid)) \r
+ fStringIO.write(''.join(UniGuid))\r
UniValue = pack ('Q', int (Item[1], 16))\r
fStringIO.write (UniValue)\r
else:\r
#\r
VfrGuid = [0xb4, 0x7c, 0xbc, 0xd0, 0x47, 0x6a, 0x5f, 0x49, 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2]\r
VfrGuid = [chr(ItemGuid) for ItemGuid in VfrGuid]\r
- fStringIO.write(''.join(VfrGuid)) \r
+ fStringIO.write(''.join(VfrGuid))\r
VfrValue = pack ('Q', int (Item[1], 16))\r
fStringIO.write (VfrValue)\r
#\r
# write data into file.\r
#\r
- try : \r
+ try :\r
fInputfile.write (fStringIO.getvalue())\r
except:\r
EdkLogger.error("build", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the "\r
- "file been locked or using by other applications." %UniVfrOffsetFileName,None)\r
+ "file been locked or using by other applications." %UniVfrOffsetFileName, None)\r
\r
fStringIO.close ()\r
fInputfile.close ()\r
\r
if self.IsAsBuiltInfCreated:\r
return\r
- \r
+\r
# Skip the following code for EDK I inf\r
if self.AutoGenVersion < 0x00010005:\r
return\r
- \r
+\r
# Skip the following code for libraries\r
if self.IsLibrary:\r
return\r
- \r
+\r
# Skip the following code for modules with no source files\r
if not self.SourceFileList:\r
return\r
# Skip the following code for modules without any binary files\r
if self.BinaryFileList:\r
return\r
- \r
+\r
### TODO: How to handles mixed source and binary modules\r
\r
# Find all DynamicEx and PatchableInModule PCDs used by this module and dependent libraries\r
PcdItem = PcdComments + '\n ' + PcdItem\r
AsBuiltInfDict['patchablepcd_item'].append(PcdItem)\r
\r
- HiiPcds = set()\r
for Pcd in Pcds + VfrPcds:\r
PcdCommentList = []\r
HiiInfo = ''\r
- SkuId = ''\r
TokenCName = Pcd.TokenCName\r
for PcdItem in GlobalData.MixedPcd:\r
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:\r
if Pcd.Type == TAB_PCDS_DYNAMIC_EX_HII:\r
for SkuName in Pcd.SkuInfoList:\r
SkuInfo = Pcd.SkuInfoList[SkuName]\r
- SkuId = SkuInfo.SkuId\r
HiiInfo = '## %s|%s|%s' % (SkuInfo.VariableName, SkuInfo.VariableGuid, SkuInfo.VariableOffset)\r
break\r
- if SkuId:\r
- #\r
- # Don't generate duplicated HII PCD\r
- #\r
- if (SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in HiiPcds:\r
- continue\r
- HiiPcds.add((SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in self._PcdComments:\r
PcdCommentList = self._PcdComments[Pcd.TokenSpaceGuidCName, Pcd.TokenCName][:]\r
if HiiInfo:\r
UsageIndex = Index\r
break\r
if UsageIndex != -1:\r
- PcdCommentList[UsageIndex] = '## %s %s %s' % (UsageStr, HiiInfo, PcdCommentList[UsageIndex].replace(UsageStr, '')) \r
+ PcdCommentList[UsageIndex] = '## %s %s %s' % (UsageStr, HiiInfo, PcdCommentList[UsageIndex].replace(UsageStr, ''))\r
else:\r
PcdCommentList.append('## UNDEFINED ' + HiiInfo)\r
PcdComments = '\n '.join(PcdCommentList)\r
# Generated LibraryClasses section in comments.\r
for Library in self.LibraryAutoGenList:\r
AsBuiltInfDict['libraryclasses_item'].append(Library.MetaFile.File.replace('\\', '/'))\r
- \r
+\r
# Generated UserExtensions TianoCore section.\r
# All tianocore user extensions are copied.\r
UserExtStr = ''\r
# Generated depex expression section in comments.\r
DepexExpresion = self._GetDepexExpresionString()\r
AsBuiltInfDict['depexsection_item'] = DepexExpresion if DepexExpresion else ''\r
- \r
+\r
AsBuiltInf = TemplateString()\r
AsBuiltInf.Append(gAsBuiltInfHeaderString.Replace(AsBuiltInfDict))\r
- \r
+\r
SaveFileOnChange(os.path.join(self.OutputDir, self.Name + '.inf'), str(AsBuiltInf), False)\r
- \r
+\r
self.IsAsBuiltInfCreated = True\r
if GlobalData.gBinCacheDest:\r
self.CopyModuleToCache()\r
def CopyBinaryFiles(self):\r
for File in self.Module.Binaries:\r
SrcPath = File.Path\r
- DstPath = os.path.join(self.OutputDir , os.path.basename(SrcPath))\r
+ DstPath = os.path.join(self.OutputDir, os.path.basename(SrcPath))\r
CopyLongFilePath(SrcPath, DstPath)\r
## Create autogen code for the module and its dependent libraries\r
#\r
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)\r
DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}\r
\r
- if len(Dpx.PostfixNotation) <> 0:\r
+ if len(Dpx.PostfixNotation) != 0:\r
self.DepexGenerated = True\r
\r
if Dpx.Generate(path.join(self.OutputDir, DpxFile)):\r
def CanSkipbyHash(self):\r
if GlobalData.gUseHashCache:\r
return not self.GenModuleHash()\r
+ return False\r
\r
## Decide whether we can skip the ModuleAutoGen process\r
# If any source file is newer than the module than we cannot skip\r
#\r
def CanSkip(self):\r
+ if self.MakeFileDir in GlobalData.gSikpAutoGenCache:\r
+ return True\r
if not os.path.exists(self.GetTimeStampPath()):\r
return False\r
#last creation time of the module\r
if SrcTimeStamp > DstTimeStamp:\r
return False\r
\r
- with open(self.GetTimeStampPath(),'r') as f:\r
+ with open(self.GetTimeStampPath(), 'r') as f:\r
for source in f:\r
source = source.rstrip('\n')\r
if not os.path.exists(source):\r
ModuleAutoGen.TimeDict[source] = os.stat(source)[8]\r
if ModuleAutoGen.TimeDict[source] > DstTimeStamp:\r
return False\r
+ GlobalData.gSikpAutoGenCache.add(self.MakeFileDir)\r
return True\r
\r
def GetTimeStampPath(self):\r
BuildOption = property(_GetModuleBuildOption)\r
BuildOptionIncPathList = property(_GetBuildOptionIncPathList)\r
BuildCommand = property(_GetBuildCommand)\r
- \r
+\r
FixedAtBuildPcds = property(_GetFixedAtBuildPcds)\r
+ UniqueBaseName = property(_GetUniqueBaseName)\r
+ FixedVoidTypePcds = property(_GetFixedAtBuildVoidTypePcds)\r
\r
# This acts like the main() function for the script, unless it is 'import'ed into another script.\r
if __name__ == '__main__':\r