1## @file 2# This file is used to define each component of INF file 3# 4# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> 5# This program and the accompanying materials 6# are licensed and made available under the terms and conditions of the BSD License 7# which accompanies this distribution. The full text of the license may be found at 8# http://opensource.org/licenses/bsd-license.php 9# 10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12# 13 14## 15# Import Modules 16# 17import Common.LongFilePathOs as os 18import re 19import EdkLogger 20from CommonDataClass.CommonClass import LibraryClassClass 21from CommonDataClass.ModuleClass import * 22from String import * 23from DataType import * 24from Identification import * 25from Dictionary import * 26from BuildToolError import * 27from Misc import sdict 28import GlobalData 29from Table.TableInf import TableInf 30import Database 31from Parsing import * 32from Common.LongFilePathSupport import OpenLongFilePath as open 33 34# 35# Global variable 36# 37Section = {TAB_UNKNOWN.upper() : MODEL_UNKNOWN, 38 TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER, 39 TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, 40 TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, 41 TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, 42 TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, 43 TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE, 44 TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE, 45 TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD, 46 TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, 47 TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG, 48 TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX, 49 TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC, 50 TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE, 51 TAB_GUIDS.upper() : MODEL_EFI_GUID, 52 TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, 53 TAB_PPIS.upper() : MODEL_EFI_PPI, 54 TAB_DEPEX.upper() : MODEL_EFI_DEPEX, 55 TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE, 56 TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION 57 } 58 59gComponentType2ModuleType = { 60 "LIBRARY" : "BASE", 61 "SECURITY_CORE" : "SEC", 62 "PEI_CORE" : "PEI_CORE", 63 "COMBINED_PEIM_DRIVER" : "PEIM", 64 "PIC_PEIM" : "PEIM", 65 "RELOCATABLE_PEIM" : "PEIM", 66 "PE32_PEIM" : "PEIM", 67 "BS_DRIVER" : "DXE_DRIVER", 68 "RT_DRIVER" : "DXE_RUNTIME_DRIVER", 69 "SAL_RT_DRIVER" : "DXE_SAL_DRIVER", 70 "APPLICATION" : "UEFI_APPLICATION", 71 "LOGO" : "BASE", 72} 73 74gNmakeFlagPattern = re.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re.UNICODE) 75gNmakeFlagName2ToolCode = { 76 "C" : "CC", 77 "LIB" : "SLINK", 78 "LINK" : "DLINK", 79} 80 81class InfHeader(ModuleHeaderClass): 82 _Mapping_ = { 83 # 84 # Required Fields 85 # 86 TAB_INF_DEFINES_BASE_NAME : "Name", 87 TAB_INF_DEFINES_FILE_GUID : "Guid", 88 TAB_INF_DEFINES_MODULE_TYPE : "ModuleType", 89 TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "UefiSpecificationVersion", 90 TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : "UefiSpecificationVersion", 91 TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion", 92 # 93 # Optional Fields 94 # 95 TAB_INF_DEFINES_INF_VERSION : "InfVersion", 96 TAB_INF_DEFINES_BINARY_MODULE : "BinaryModule", 97 TAB_INF_DEFINES_COMPONENT_TYPE : "ComponentType", 98 TAB_INF_DEFINES_MAKEFILE_NAME : "MakefileName", 99 TAB_INF_DEFINES_BUILD_NUMBER : "BuildNumber", 100 TAB_INF_DEFINES_BUILD_TYPE : "BuildType", 101 TAB_INF_DEFINES_FFS_EXT : "FfsExt", 102 TAB_INF_DEFINES_FV_EXT : "FvExt", 103 TAB_INF_DEFINES_SOURCE_FV : "SourceFv", 104 TAB_INF_DEFINES_VERSION_NUMBER : "VersionNumber", 105 TAB_INF_DEFINES_VERSION_STRING : "VersionString", 106 TAB_INF_DEFINES_VERSION : "Version", 107 TAB_INF_DEFINES_PCD_IS_DRIVER : "PcdIsDriver", 108 TAB_INF_DEFINES_TIANO_EDK_FLASHMAP_H : "TianoEdkFlashMap_h", 109 TAB_INF_DEFINES_SHADOW : "Shadow", 110# TAB_INF_DEFINES_LIBRARY_CLASS : "LibraryClass", 111# TAB_INF_DEFINES_ENTRY_POINT : "ExternImages", 112# TAB_INF_DEFINES_UNLOAD_IMAGE : "ExternImages", 113# TAB_INF_DEFINES_CONSTRUCTOR : , 114# TAB_INF_DEFINES_DESTRUCTOR : , 115# TAB_INF_DEFINES_DEFINE : "Define", 116# TAB_INF_DEFINES_SPEC : "Specification", 117# TAB_INF_DEFINES_CUSTOM_MAKEFILE : "CustomMakefile", 118# TAB_INF_DEFINES_MACRO : 119 } 120 121 def __init__(self): 122 ModuleHeaderClass.__init__(self) 123 self.VersionNumber = '' 124 self.VersionString = '' 125 #print self.__dict__ 126 def __setitem__(self, key, value): 127 self.__dict__[self._Mapping_[key]] = value 128 def __getitem__(self, key): 129 return self.__dict__[self._Mapping_[key]] 130 ## "in" test support 131 def __contains__(self, key): 132 return key in self._Mapping_ 133 134## InfObject 135# 136# This class defined basic Inf object which is used by inheriting 137# 138# @param object: Inherited from object class 139# 140class InfObject(object): 141 def __init__(self): 142 object.__init__() 143 144## Inf 145# 146# This class defined the structure used in Inf object 147# 148# @param InfObject: Inherited from InfObject class 149# @param Ffilename: Input value for Ffilename of Inf file, default is None 150# @param IsMergeAllArches: Input value for IsMergeAllArches 151# True is to merge all arches 152# Fales is not to merge all arches 153# default is False 154# @param IsToModule: Input value for IsToModule 155# True is to transfer to ModuleObject automatically 156# False is not to transfer to ModuleObject automatically 157# default is False 158# @param WorkspaceDir: Input value for current workspace directory, default is None 159# 160# @var Identification: To store value for Identification, it is a structure as Identification 161# @var UserExtensions: To store value for UserExtensions 162# @var Module: To store value for Module, it is a structure as ModuleClass 163# @var WorkspaceDir: To store value for WorkspaceDir 164# @var KeyList: To store value for KeyList, a list for all Keys used in Inf 165# 166class Inf(InfObject): 167 def __init__(self, Filename=None, IsToDatabase=False, IsToModule=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST): 168 self.Identification = Identification() 169 self.Module = ModuleClass() 170 self.UserExtensions = '' 171 self.WorkspaceDir = WorkspaceDir 172 self.SupArchList = SupArchList 173 self.IsToDatabase = IsToDatabase 174 175 self.Cur = Database.Cur 176 self.TblFile = Database.TblFile 177 self.TblInf = Database.TblInf 178 self.FileID = -1 179 #self.TblInf = TableInf(Database.Cur) 180 181 self.KeyList = [ 182 TAB_SOURCES, TAB_BUILD_OPTIONS, TAB_BINARIES, TAB_INCLUDES, TAB_GUIDS, 183 TAB_PROTOCOLS, TAB_PPIS, TAB_LIBRARY_CLASSES, TAB_PACKAGES, TAB_LIBRARIES, 184 TAB_INF_FIXED_PCD, TAB_INF_PATCH_PCD, TAB_INF_FEATURE_PCD, TAB_INF_PCD, 185 TAB_INF_PCD_EX, TAB_DEPEX, TAB_NMAKE, TAB_INF_DEFINES 186 ] 187 # 188 # Upper all KEYs to ignore case sensitive when parsing 189 # 190 self.KeyList = map(lambda c: c.upper(), self.KeyList) 191 192 # 193 # Init RecordSet 194 # 195 self.RecordSet = {} 196 for Key in self.KeyList: 197 self.RecordSet[Section[Key]] = [] 198 199 # 200 # Load Inf file if filename is not None 201 # 202 if Filename != None: 203 self.LoadInfFile(Filename) 204 205 # 206 # Transfer to Module Object if IsToModule is True 207 # 208 if IsToModule: 209 self.InfToModule() 210 211 ## Transfer to Module Object 212 # 213 # Transfer all contents of an Inf file to a standard Module Object 214 # 215 def InfToModule(self): 216 # 217 # Init global information for the file 218 # 219 ContainerFile = self.Identification.FileFullPath 220 221 # 222 # Generate Package Header 223 # 224 self.GenModuleHeader(ContainerFile) 225 226 # 227 # Generate BuildOptions 228 # 229 self.GenBuildOptions(ContainerFile) 230 231 # 232 # Generate Includes 233 # 234 self.GenIncludes(ContainerFile) 235 236 # 237 # Generate Libraries 238 # 239 self.GenLibraries(ContainerFile) 240 241 # 242 # Generate LibraryClasses 243 # 244 self.GenLibraryClasses(ContainerFile) 245 246 # 247 # Generate Packages 248 # 249 self.GenPackages(ContainerFile) 250 251 # 252 # Generate Nmakes 253 # 254 self.GenNmakes(ContainerFile) 255 256 # 257 # Generate Pcds 258 # 259 self.GenPcds(ContainerFile) 260 261 # 262 # Generate Sources 263 # 264 self.GenSources(ContainerFile) 265 266 # 267 # Generate UserExtensions 268 # 269 self.GenUserExtensions(ContainerFile) 270 271 # 272 # Generate Guids 273 # 274 self.GenGuidProtocolPpis(DataType.TAB_GUIDS, ContainerFile) 275 276 # 277 # Generate Protocols 278 # 279 self.GenGuidProtocolPpis(DataType.TAB_PROTOCOLS, ContainerFile) 280 281 # 282 # Generate Ppis 283 # 284 self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile) 285 286 # 287 # Generate Depexes 288 # 289 self.GenDepexes(ContainerFile) 290 291 # 292 # Generate Binaries 293 # 294 self.GenBinaries(ContainerFile) 295 296 ## Parse [Defines] section 297 # 298 # Parse [Defines] section into InfDefines object 299 # 300 # @param InfFile The path of the INF file 301 # @param Section The title of "Defines" section 302 # @param Lines The content of "Defines" section 303 # 304 def ParseDefines(self, InfFile, Section, Lines): 305 TokenList = Section.split(TAB_SPLIT) 306 if len(TokenList) == 3: 307 RaiseParserError(Section, "Defines", InfFile, "[xx.yy.%s] format (with platform) is not supported") 308 if len(TokenList) == 2: 309 Arch = TokenList[1].upper() 310 else: 311 Arch = TAB_ARCH_COMMON 312 313 if Arch not in self.Defines: 314 self.Defines[Arch] = InfDefines() 315 GetSingleValueOfKeyFromLines(Lines, self.Defines[Arch].DefinesDictionary, 316 TAB_COMMENT_SPLIT, TAB_EQUAL_SPLIT, False, None) 317 318 ## Load Inf file 319 # 320 # Load the file if it exists 321 # 322 # @param Filename: Input value for filename of Inf file 323 # 324 def LoadInfFile(self, Filename): 325 # 326 # Insert a record for file 327 # 328 Filename = NormPath(Filename) 329 self.Identification.FileFullPath = Filename 330 (self.Identification.FileRelativePath, self.Identification.FileName) = os.path.split(Filename) 331 self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_INF) 332 333 # 334 # Init InfTable 335 # 336 #self.TblInf.Table = "Inf%s" % self.FileID 337 #self.TblInf.Create() 338 339 # 340 # Init common datas 341 # 342 IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \ 343 [], [], TAB_UNKNOWN, [], [], [] 344 LineNo = 0 345 346 # 347 # Parse file content 348 # 349 IsFindBlockComment = False 350 ReservedLine = '' 351 for Line in open(Filename, 'r'): 352 LineNo = LineNo + 1 353 # 354 # Remove comment block 355 # 356 if Line.find(TAB_COMMENT_EDK_START) > -1: 357 ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0] 358 IsFindBlockComment = True 359 if Line.find(TAB_COMMENT_EDK_END) > -1: 360 Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1] 361 ReservedLine = '' 362 IsFindBlockComment = False 363 if IsFindBlockComment: 364 continue 365 366 # 367 # Remove comments at tail and remove spaces again 368 # 369 Line = CleanString(Line) 370 if Line == '': 371 continue 372 373 # 374 # Find a new section tab 375 # First insert previous section items 376 # And then parse the content of the new section 377 # 378 if Line.startswith(TAB_SECTION_START) and Line.endswith(TAB_SECTION_END): 379 if Line[1:3] == "--": 380 continue 381 Model = Section[CurrentSection.upper()] 382 # 383 # Insert items data of previous section 384 # 385 InsertSectionItemsIntoDatabase(self.TblInf, self.FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, self.RecordSet) 386 # 387 # Parse the new section 388 # 389 SectionItemList = [] 390 ArchList = [] 391 ThirdList = [] 392 393 CurrentSection = '' 394 LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT) 395 for Item in LineList: 396 ItemList = GetSplitValueList(Item, TAB_SPLIT) 397 if CurrentSection == '': 398 CurrentSection = ItemList[0] 399 else: 400 if CurrentSection != ItemList[0]: 401 EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError) 402 if CurrentSection.upper() not in self.KeyList: 403 RaiseParserError(Line, CurrentSection, Filename, '', LineNo) 404 CurrentSection = TAB_UNKNOWN 405 continue 406 ItemList.append('') 407 ItemList.append('') 408 if len(ItemList) > 5: 409 RaiseParserError(Line, CurrentSection, Filename, '', LineNo) 410 else: 411 if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: 412 EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError) 413 ArchList.append(ItemList[1].upper()) 414 ThirdList.append(ItemList[2]) 415 416 continue 417 418 # 419 # Not in any defined section 420 # 421 if CurrentSection == TAB_UNKNOWN: 422 ErrorMsg = "%s is not in any defined section" % Line 423 EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError) 424 425 # 426 # Add a section item 427 # 428 SectionItemList.append([Line, LineNo]) 429 # End of parse 430 #End of For 431 432 # 433 # Insert items data of last section 434 # 435 Model = Section[CurrentSection.upper()] 436 InsertSectionItemsIntoDatabase(self.TblInf, self.FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, self.RecordSet) 437 438 # 439 # Replace all DEFINE macros with its actual values 440 # 441 ParseDefineMacro2(self.TblInf, self.RecordSet, GlobalData.gGlobalDefines) 442 443 ## Show detailed information of Module 444 # 445 # Print all members and their values of Module class 446 # 447 def ShowModule(self): 448 M = self.Module 449 for Arch in M.Header.keys(): 450 print '\nArch =', Arch 451 print 'Filename =', M.Header[Arch].FileName 452 print 'FullPath =', M.Header[Arch].FullPath 453 print 'BaseName =', M.Header[Arch].Name 454 print 'Guid =', M.Header[Arch].Guid 455 print 'Version =', M.Header[Arch].Version 456 print 'InfVersion =', M.Header[Arch].InfVersion 457 print 'UefiSpecificationVersion =', M.Header[Arch].UefiSpecificationVersion 458 print 'EdkReleaseVersion =', M.Header[Arch].EdkReleaseVersion 459 print 'ModuleType =', M.Header[Arch].ModuleType 460 print 'BinaryModule =', M.Header[Arch].BinaryModule 461 print 'ComponentType =', M.Header[Arch].ComponentType 462 print 'MakefileName =', M.Header[Arch].MakefileName 463 print 'BuildNumber =', M.Header[Arch].BuildNumber 464 print 'BuildType =', M.Header[Arch].BuildType 465 print 'FfsExt =', M.Header[Arch].FfsExt 466 print 'FvExt =', M.Header[Arch].FvExt 467 print 'SourceFv =', M.Header[Arch].SourceFv 468 print 'PcdIsDriver =', M.Header[Arch].PcdIsDriver 469 print 'TianoEdkFlashMap_h =', M.Header[Arch].TianoEdkFlashMap_h 470 print 'Shadow =', M.Header[Arch].Shadow 471 print 'LibraryClass =', M.Header[Arch].LibraryClass 472 for Item in M.Header[Arch].LibraryClass: 473 print Item.LibraryClass, DataType.TAB_VALUE_SPLIT.join(Item.SupModuleList) 474 print 'CustomMakefile =', M.Header[Arch].CustomMakefile 475 print 'Define =', M.Header[Arch].Define 476 print 'Specification =', M.Header[Arch].Specification 477 for Item in self.Module.ExternImages: 478 print '\nEntry_Point = %s, UnloadImage = %s' % (Item.ModuleEntryPoint, Item.ModuleUnloadImage) 479 for Item in self.Module.ExternLibraries: 480 print 'Constructor = %s, Destructor = %s' % (Item.Constructor, Item.Destructor) 481 print '\nBuildOptions =', M.BuildOptions 482 for Item in M.BuildOptions: 483 print Item.ToolChainFamily, Item.ToolChain, Item.Option, Item.SupArchList 484 print '\nIncludes =', M.Includes 485 for Item in M.Includes: 486 print Item.FilePath, Item.SupArchList 487 print '\nLibraries =', M.Libraries 488 for Item in M.Libraries: 489 print Item.Library, Item.SupArchList 490 print '\nLibraryClasses =', M.LibraryClasses 491 for Item in M.LibraryClasses: 492 print Item.LibraryClass, Item.RecommendedInstance, Item.FeatureFlag, Item.SupModuleList, Item.SupArchList, Item.Define 493 print '\nPackageDependencies =', M.PackageDependencies 494 for Item in M.PackageDependencies: 495 print Item.FilePath, Item.SupArchList, Item.FeatureFlag 496 print '\nNmake =', M.Nmake 497 for Item in M.Nmake: 498 print Item.Name, Item.Value, Item.SupArchList 499 print '\nPcds =', M.PcdCodes 500 for Item in M.PcdCodes: 501 print '\tCName=', Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList 502 print '\nSources =', M.Sources 503 for Source in M.Sources: 504 print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList 505 print '\nUserExtensions =', M.UserExtensions 506 for UserExtension in M.UserExtensions: 507 print UserExtension.UserID, UserExtension.Identifier, UserExtension.Content 508 print '\nGuids =', M.Guids 509 for Item in M.Guids: 510 print Item.CName, Item.SupArchList, Item.FeatureFlag 511 print '\nProtocols =', M.Protocols 512 for Item in M.Protocols: 513 print Item.CName, Item.SupArchList, Item.FeatureFlag 514 print '\nPpis =', M.Ppis 515 for Item in M.Ppis: 516 print Item.CName, Item.SupArchList, Item.FeatureFlag 517 print '\nDepex =', M.Depex 518 for Item in M.Depex: 519 print Item.Depex, Item.SupArchList, Item.Define 520 print '\nBinaries =', M.Binaries 521 for Binary in M.Binaries: 522 print 'Type=', Binary.FileType, 'Target=', Binary.Target, 'Name=', Binary.BinaryFile, 'FeatureFlag=', Binary.FeatureFlag, 'SupArchList=', Binary.SupArchList 523 524 ## Convert [Defines] section content to ModuleHeaderClass 525 # 526 # Convert [Defines] section content to ModuleHeaderClass 527 # 528 # @param Defines The content under [Defines] section 529 # @param ModuleHeader An object of ModuleHeaderClass 530 # @param Arch The supported ARCH 531 # 532 def GenModuleHeader(self, ContainerFile): 533 EdkLogger.debug(2, "Generate ModuleHeader ...") 534 File = self.Identification.FileFullPath 535 # 536 # Update all defines item in database 537 # 538 RecordSet = self.RecordSet[MODEL_META_DATA_HEADER] 539 for Record in RecordSet: 540 ValueList = GetSplitValueList(Record[0], TAB_EQUAL_SPLIT) 541 if len(ValueList) != 2: 542 RaiseParserError(Record[0], 'Defines', ContainerFile, '<Key> = <Value>', Record[2]) 543 ID, Value1, Value2, Arch, LineNo = Record[3], ValueList[0], ValueList[1], Record[1], Record[2] 544 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s' 545 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Value1), ConvertToSqlString2(Value2), ID) 546 self.TblInf.Exec(SqlCommand) 547 548 for Arch in DataType.ARCH_LIST: 549 ModuleHeader = InfHeader() 550 ModuleHeader.FileName = self.Identification.FileName 551 ModuleHeader.FullPath = self.Identification.FileFullPath 552 DefineList = QueryDefinesItem2(self.TblInf, Arch, self.FileID) 553 554 NotProcessedDefineList = [] 555 for D in DefineList: 556 if D[0] in ModuleHeader: 557 ModuleHeader[D[0]] = GetSplitValueList(D[1])[0] 558 else: 559 NotProcessedDefineList.append(D) 560 561 if ModuleHeader.ComponentType == "LIBRARY": 562 Lib = LibraryClassClass() 563 Lib.LibraryClass = ModuleHeader.Name 564 Lib.SupModuleList = DataType.SUP_MODULE_LIST 565 ModuleHeader.LibraryClass.append(Lib) 566 567 # we need to make some key defines resolved first 568 for D in NotProcessedDefineList: 569 if D[0] == TAB_INF_DEFINES_LIBRARY_CLASS: 570 List = GetSplitValueList(D[1], DataType.TAB_VALUE_SPLIT, 1) 571 Lib = LibraryClassClass() 572 Lib.LibraryClass = CleanString(List[0]) 573 if len(List) == 1: 574 Lib.SupModuleList = DataType.SUP_MODULE_LIST 575 elif len(List) == 2: 576 Lib.SupModuleList = GetSplitValueList(CleanString(List[1]), ' ') 577 ModuleHeader.LibraryClass.append(Lib) 578 elif D[0] == TAB_INF_DEFINES_CUSTOM_MAKEFILE: 579 List = D[1].split(DataType.TAB_VALUE_SPLIT) 580 if len(List) == 2: 581 ModuleHeader.CustomMakefile[CleanString(List[0])] = CleanString(List[1]) 582 else: 583 RaiseParserError(D[1], 'CUSTOM_MAKEFILE of Defines', File, 'CUSTOM_MAKEFILE=<Family>|<Filename>', D[2]) 584 elif D[0] == TAB_INF_DEFINES_ENTRY_POINT: 585 Image = ModuleExternImageClass() 586 Image.ModuleEntryPoint = CleanString(D[1]) 587 self.Module.ExternImages.append(Image) 588 elif D[0] == TAB_INF_DEFINES_UNLOAD_IMAGE: 589 Image = ModuleExternImageClass() 590 Image.ModuleUnloadImage = CleanString(D[1]) 591 self.Module.ExternImages.append(Image) 592 elif D[0] == TAB_INF_DEFINES_CONSTRUCTOR: 593 LibraryClass = ModuleExternLibraryClass() 594 LibraryClass.Constructor = CleanString(D[1]) 595 self.Module.ExternLibraries.append(LibraryClass) 596 elif D[0] == TAB_INF_DEFINES_DESTRUCTOR: 597 LibraryClass = ModuleExternLibraryClass() 598 LibraryClass.Destructor = CleanString(D[1]) 599 self.Module.ExternLibraries.append(LibraryClass) 600 elif D[0] == TAB_INF_DEFINES_DEFINE: 601 List = D[1].split(DataType.TAB_EQUAL_SPLIT) 602 if len(List) != 2: 603 RaiseParserError(Item, 'DEFINE of Defines', File, 'DEFINE <Word> = <Word>', D[2]) 604 else: 605 ModuleHeader.Define[CleanString(List[0])] = CleanString(List[1]) 606 elif D[0] == TAB_INF_DEFINES_SPEC: 607 List = D[1].split(DataType.TAB_EQUAL_SPLIT) 608 if len(List) != 2: 609 RaiseParserError(Item, 'SPEC of Defines', File, 'SPEC <Word> = <Version>', D[2]) 610 else: 611 ModuleHeader.Specification[CleanString(List[0])] = CleanString(List[1]) 612 613 # 614 # Get version of INF 615 # 616 if ModuleHeader.InfVersion != "": 617 # EdkII inf 618 VersionNumber = ModuleHeader.VersionNumber 619 VersionString = ModuleHeader.VersionString 620 if len(VersionNumber) > 0 and len(VersionString) == 0: 621 EdkLogger.warn(2000, 'VERSION_NUMBER depricated; INF file %s should be modified to use VERSION_STRING instead.' % self.Identification.FileFullPath) 622 ModuleHeader.Version = VersionNumber 623 if len(VersionString) > 0: 624 if len(VersionNumber) > 0: 625 EdkLogger.warn(2001, 'INF file %s defines both VERSION_NUMBER and VERSION_STRING, using VERSION_STRING' % self.Identification.FileFullPath) 626 ModuleHeader.Version = VersionString 627 else: 628 # Edk inf 629 ModuleHeader.InfVersion = "0x00010000" 630 if ModuleHeader.ComponentType in gComponentType2ModuleType: 631 ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType] 632 elif ModuleHeader.ComponentType != '': 633 EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError=EdkLogger.IsRaiseError) 634 635 self.Module.Header[Arch] = ModuleHeader 636 637 638 ## GenBuildOptions 639 # 640 # Gen BuildOptions of Inf 641 # [<Family>:]<ToolFlag>=Flag 642 # 643 # @param ContainerFile: The Inf file full path 644 # 645 def GenBuildOptions(self, ContainerFile): 646 EdkLogger.debug(2, "Generate %s ..." % TAB_BUILD_OPTIONS) 647 BuildOptions = {} 648 # 649 # Get all BuildOptions 650 # 651 RecordSet = self.RecordSet[MODEL_META_DATA_BUILD_OPTION] 652 653 # 654 # Go through each arch 655 # 656 for Arch in self.SupArchList: 657 for Record in RecordSet: 658 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 659 (Family, ToolChain, Flag) = GetBuildOption(Record[0], ContainerFile, Record[2]) 660 MergeArches(BuildOptions, (Family, ToolChain, Flag), Arch) 661 # 662 # Update to Database 663 # 664 if self.IsToDatabase: 665 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s', Value3 = '%s' 666 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Family), ConvertToSqlString2(ToolChain), ConvertToSqlString2(Flag), Record[3]) 667 self.TblInf.Exec(SqlCommand) 668 669 for Key in BuildOptions.keys(): 670 BuildOption = BuildOptionClass(Key[0], Key[1], Key[2]) 671 BuildOption.SupArchList = BuildOptions[Key] 672 self.Module.BuildOptions.append(BuildOption) 673 674 ## GenIncludes 675 # 676 # Gen Includes of Inf 677 # 678 # 679 # @param ContainerFile: The Inf file full path 680 # 681 def GenIncludes(self, ContainerFile): 682 EdkLogger.debug(2, "Generate %s ..." % TAB_INCLUDES) 683 Includes = sdict() 684 # 685 # Get all Includes 686 # 687 RecordSet = self.RecordSet[MODEL_EFI_INCLUDE] 688 689 # 690 # Go through each arch 691 # 692 for Arch in self.SupArchList: 693 for Record in RecordSet: 694 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 695 MergeArches(Includes, Record[0], Arch) 696 697 for Key in Includes.keys(): 698 Include = IncludeClass() 699 Include.FilePath = NormPath(Key) 700 Include.SupArchList = Includes[Key] 701 self.Module.Includes.append(Include) 702 703 ## GenLibraries 704 # 705 # Gen Libraries of Inf 706 # 707 # 708 # @param ContainerFile: The Inf file full path 709 # 710 def GenLibraries(self, ContainerFile): 711 EdkLogger.debug(2, "Generate %s ..." % TAB_LIBRARIES) 712 Libraries = sdict() 713 # 714 # Get all Includes 715 # 716 RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_INSTANCE] 717 718 # 719 # Go through each arch 720 # 721 for Arch in self.SupArchList: 722 for Record in RecordSet: 723 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 724 MergeArches(Libraries, Record[0], Arch) 725 726 for Key in Libraries.keys(): 727 Library = ModuleLibraryClass() 728 # replace macro and remove file extension 729 Library.Library = Key.rsplit('.', 1)[0] 730 Library.SupArchList = Libraries[Key] 731 self.Module.Libraries.append(Library) 732 733 ## GenLibraryClasses 734 # 735 # Get LibraryClass of Inf 736 # <LibraryClassKeyWord>|<LibraryInstance> 737 # 738 # @param ContainerFile: The Inf file full path 739 # 740 def GenLibraryClasses(self, ContainerFile): 741 EdkLogger.debug(2, "Generate %s ..." % TAB_LIBRARY_CLASSES) 742 LibraryClasses = {} 743 # 744 # Get all LibraryClasses 745 # 746 RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS] 747 748 # 749 # Go through each arch 750 # 751 for Arch in self.SupArchList: 752 for Record in RecordSet: 753 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 754 (LibClassName, LibClassIns, Pcd, SupModelList) = GetLibraryClassOfInf([Record[0], Record[4]], ContainerFile, self.WorkspaceDir, Record[2]) 755 MergeArches(LibraryClasses, (LibClassName, LibClassIns, Pcd, SupModelList), Arch) 756 # 757 # Update to Database 758 # 759 if self.IsToDatabase: 760 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s', Value3 = '%s' 761 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(LibClassName), ConvertToSqlString2(LibClassIns), ConvertToSqlString2(SupModelList), Record[3]) 762 self.TblInf.Exec(SqlCommand) 763 764 for Key in LibraryClasses.keys(): 765 KeyList = Key[0].split(DataType.TAB_VALUE_SPLIT) 766 LibraryClass = LibraryClassClass() 767 LibraryClass.LibraryClass = Key[0] 768 LibraryClass.RecommendedInstance = NormPath(Key[1]) 769 LibraryClass.FeatureFlag = Key[2] 770 LibraryClass.SupArchList = LibraryClasses[Key] 771 LibraryClass.SupModuleList = GetSplitValueList(Key[3]) 772 self.Module.LibraryClasses.append(LibraryClass) 773 774 ## GenPackages 775 # 776 # Gen Packages of Inf 777 # 778 # 779 # @param ContainerFile: The Inf file full path 780 # 781 def GenPackages(self, ContainerFile): 782 EdkLogger.debug(2, "Generate %s ..." % TAB_PACKAGES) 783 Packages = {} 784 # 785 # Get all Packages 786 # 787 RecordSet = self.RecordSet[MODEL_META_DATA_PACKAGE] 788 789 # 790 # Go through each arch 791 # 792 for Arch in self.SupArchList: 793 for Record in RecordSet: 794 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 795 (Package, Pcd) = GetPackage(Record[0], ContainerFile, self.WorkspaceDir, Record[2]) 796 MergeArches(Packages, (Package, Pcd), Arch) 797 if self.IsToDatabase: 798 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s' 799 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Package), ConvertToSqlString2(Pcd), Record[3]) 800 self.TblInf.Exec(SqlCommand) 801 802 803 for Key in Packages.keys(): 804 Package = ModulePackageDependencyClass() 805 Package.FilePath = NormPath(Key[0]) 806 Package.SupArchList = Packages[Key] 807 Package.FeatureFlag = Key[1] 808 self.Module.PackageDependencies.append(Package) 809 810 ## GenNmakes 811 # 812 # Gen Nmakes of Inf 813 # 814 # 815 # @param ContainerFile: The Inf file full path 816 # 817 def GenNmakes(self, ContainerFile): 818 EdkLogger.debug(2, "Generate %s ..." % TAB_NMAKE) 819 Nmakes = sdict() 820 # 821 # Get all Nmakes 822 # 823 RecordSet = self.RecordSet[MODEL_META_DATA_NMAKE] 824 825 826 # 827 # Go through each arch 828 # 829 for Arch in self.SupArchList: 830 for Record in RecordSet: 831 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 832 MergeArches(Nmakes, Record[0], Arch) 833 834 for Key in Nmakes.keys(): 835 List = GetSplitValueList(Key, DataType.TAB_EQUAL_SPLIT, MaxSplit=1) 836 if len(List) != 2: 837 RaiseParserError(Key, 'Nmake', ContainerFile, '<MacroName> = <Value>') 838 continue 839 Nmake = ModuleNmakeClass() 840 Nmake.Name = List[0] 841 Nmake.Value = List[1] 842 Nmake.SupArchList = Nmakes[Key] 843 self.Module.Nmake.append(Nmake) 844 845 # convert Edk format to EdkII format 846 if Nmake.Name == "IMAGE_ENTRY_POINT": 847 Image = ModuleExternImageClass() 848 Image.ModuleEntryPoint = Nmake.Value 849 self.Module.ExternImages.append(Image) 850 elif Nmake.Name == "DPX_SOURCE": 851 Source = ModuleSourceFileClass(NormPath(Nmake.Value), "", "", "", "", Nmake.SupArchList) 852 self.Module.Sources.append(Source) 853 else: 854 ToolList = gNmakeFlagPattern.findall(Nmake.Name) 855 if len(ToolList) == 0 or len(ToolList) != 1: 856 EdkLogger.warn("\nParser", "Don't know how to do with MACRO: %s" % Nmake.Name, 857 ExtraData=ContainerFile) 858 else: 859 if ToolList[0] in gNmakeFlagName2ToolCode: 860 Tool = gNmakeFlagName2ToolCode[ToolList[0]] 861 else: 862 Tool = ToolList[0] 863 BuildOption = BuildOptionClass("MSFT", "*_*_*_%s_FLAGS" % Tool, Nmake.Value) 864 BuildOption.SupArchList = Nmake.SupArchList 865 self.Module.BuildOptions.append(BuildOption) 866 867 ## GenPcds 868 # 869 # Gen Pcds of Inf 870 # <TokenSpaceGuidCName>.<PcdCName>[|<Value>] 871 # 872 # @param ContainerFile: The Dec file full path 873 # 874 def GenPcds(self, ContainerFile): 875 EdkLogger.debug(2, "Generate %s ..." % TAB_PCDS) 876 Pcds = {} 877 PcdToken = {} 878 879 # 880 # Get all Guids 881 # 882 RecordSet1 = self.RecordSet[MODEL_PCD_FIXED_AT_BUILD] 883 RecordSet2 = self.RecordSet[MODEL_PCD_PATCHABLE_IN_MODULE] 884 RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG] 885 RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX] 886 RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC] 887 888 # 889 # Go through each arch 890 # 891 for Arch in self.SupArchList: 892 for Record in RecordSet1: 893 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 894 if self.Module.Header[Arch].LibraryClass != {}: 895 pass 896 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_FIXED_AT_BUILD, ContainerFile, Record[2]) 897 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch) 898 PcdToken[Record[3]] = (TokenGuidCName, TokenName) 899 for Record in RecordSet2: 900 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 901 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_PATCHABLE_IN_MODULE, ContainerFile, Record[2]) 902 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch) 903 PcdToken[Record[3]] = (TokenGuidCName, TokenName) 904 for Record in RecordSet3: 905 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 906 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_FEATURE_FLAG, ContainerFile, Record[2]) 907 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch) 908 PcdToken[Record[3]] = (TokenGuidCName, TokenName) 909 for Record in RecordSet4: 910 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 911 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_DYNAMIC_EX, ContainerFile, Record[2]) 912 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch) 913 PcdToken[Record[3]] = (TokenGuidCName, TokenName) 914 for Record in RecordSet5: 915 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 916 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], "", ContainerFile, Record[2]) 917 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch) 918 PcdToken[Record[3]] = (TokenGuidCName, TokenName) 919 # 920 # Update to database 921 # 922 if self.IsToDatabase: 923 for Key in PcdToken.keys(): 924 SqlCommand = """update %s set Value2 = '%s' where ID = %s""" % (self.TblInf.Table, ".".join((PcdToken[Key][0], PcdToken[Key][1])), Key) 925 self.TblInf.Exec(SqlCommand) 926 927 for Key in Pcds.keys(): 928 Pcd = PcdClass() 929 Pcd.CName = Key[1] 930 Pcd.TokenSpaceGuidCName = Key[0] 931 Pcd.DefaultValue = Key[2] 932 Pcd.ItemType = Key[3] 933 Pcd.SupArchList = Pcds[Key] 934 self.Module.PcdCodes.append(Pcd) 935 936 ## GenSources 937 # 938 # Gen Sources of Inf 939 # <Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]] 940 # 941 # @param ContainerFile: The Dec file full path 942 # 943 def GenSources(self, ContainerFile): 944 EdkLogger.debug(2, "Generate %s ..." % TAB_SOURCES) 945 Sources = {} 946 947 # 948 # Get all Nmakes 949 # 950 RecordSet = self.RecordSet[MODEL_EFI_SOURCE_FILE] 951 952 # 953 # Go through each arch 954 # 955 for Arch in self.SupArchList: 956 for Record in RecordSet: 957 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 958 (Filename, Family, TagName, ToolCode, Pcd) = GetSource(Record[0], ContainerFile, self.Identification.FileRelativePath, Record[2]) 959 MergeArches(Sources, (Filename, Family, TagName, ToolCode, Pcd), Arch) 960 if self.IsToDatabase: 961 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s', Value3 = '%s', Value4 = '%s', Value5 = '%s' 962 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Filename), ConvertToSqlString2(Family), ConvertToSqlString2(TagName), ConvertToSqlString2(ToolCode), ConvertToSqlString2(Pcd), Record[3]) 963 self.TblInf.Exec(SqlCommand) 964 965 for Key in Sources.keys(): 966 Source = ModuleSourceFileClass(Key[0], Key[2], Key[3], Key[1], Key[4], Sources[Key]) 967 self.Module.Sources.append(Source) 968 969 ## GenUserExtensions 970 # 971 # Gen UserExtensions of Inf 972 # 973 def GenUserExtensions(self, ContainerFile): 974# # 975# # UserExtensions 976# # 977# if self.UserExtensions != '': 978# UserExtension = UserExtensionsClass() 979# Lines = self.UserExtensions.splitlines() 980# List = GetSplitValueList(Lines[0], DataType.TAB_SPLIT, 2) 981# if len(List) != 3: 982# RaiseParserError(Lines[0], 'UserExtensions', File, "UserExtensions.UserId.'Identifier'") 983# else: 984# UserExtension.UserID = List[1] 985# UserExtension.Identifier = List[2][0:-1].replace("'", '').replace('\"', '') 986# for Line in Lines[1:]: 987# UserExtension.Content = UserExtension.Content + CleanString(Line) + '\n' 988# self.Module.UserExtensions.append(UserExtension) 989 pass 990 991 ## GenDepexes 992 # 993 # Gen Depex of Inf 994 # 995 # @param ContainerFile: The Inf file full path 996 # 997 def GenDepexes(self, ContainerFile): 998 EdkLogger.debug(2, "Generate %s ..." % TAB_DEPEX) 999 Depex = {} 1000 # 1001 # Get all Depexes 1002 # 1003 RecordSet = self.RecordSet[MODEL_EFI_DEPEX] 1004 1005 # 1006 # Go through each arch 1007 # 1008 for Arch in self.SupArchList: 1009 Line = '' 1010 for Record in RecordSet: 1011 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 1012 Line = Line + Record[0] + ' ' 1013 if Line != '': 1014 MergeArches(Depex, Line, Arch) 1015 1016 for Key in Depex.keys(): 1017 Dep = ModuleDepexClass() 1018 Dep.Depex = Key 1019 Dep.SupArchList = Depex[Key] 1020 self.Module.Depex.append(Dep) 1021 1022 ## GenBinaries 1023 # 1024 # Gen Binary of Inf 1025 # <FileType>|<Filename>|<Target>[|<TokenSpaceGuidCName>.<PcdCName>] 1026 # 1027 # @param ContainerFile: The Dec file full path 1028 # 1029 def GenBinaries(self, ContainerFile): 1030 EdkLogger.debug(2, "Generate %s ..." % TAB_BINARIES) 1031 Binaries = {} 1032 1033 # 1034 # Get all Guids 1035 # 1036 RecordSet = self.RecordSet[MODEL_EFI_BINARY_FILE] 1037 1038 # 1039 # Go through each arch 1040 # 1041 for Arch in self.SupArchList: 1042 for Record in RecordSet: 1043 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 1044 (FileType, Filename, Target, Pcd) = GetBinary(Record[0], ContainerFile, self.Identification.FileRelativePath, Record[2]) 1045 MergeArches(Binaries, (FileType, Filename, Target, Pcd), Arch) 1046 if self.IsToDatabase: 1047 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s', Value3 = '%s', Value4 = '%s' 1048 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(FileType), ConvertToSqlString2(Filename), ConvertToSqlString2(Target), ConvertToSqlString2(Pcd), Record[3]) 1049 self.TblInf.Exec(SqlCommand) 1050 1051 for Key in Binaries.keys(): 1052 Binary = ModuleBinaryFileClass(NormPath(Key[1]), Key[0], Key[2], Key[3], Binaries[Key]) 1053 self.Module.Binaries.append(Binary) 1054 1055 ## GenGuids 1056 # 1057 # Gen Guids of Inf 1058 # <CName>=<GuidValue> 1059 # 1060 # @param ContainerFile: The Inf file full path 1061 # 1062 def GenGuidProtocolPpis(self, Type, ContainerFile): 1063 EdkLogger.debug(2, "Generate %s ..." % Type) 1064 Lists = {} 1065 # 1066 # Get all Items 1067 # 1068 RecordSet = self.RecordSet[Section[Type.upper()]] 1069 1070 # 1071 # Go through each arch 1072 # 1073 for Arch in self.SupArchList: 1074 for Record in RecordSet: 1075 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON: 1076 (Name, Value) = GetGuidsProtocolsPpisOfInf(Record[0], Type, ContainerFile, Record[2]) 1077 MergeArches(Lists, (Name, Value), Arch) 1078 if self.IsToDatabase: 1079 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s' 1080 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Name), ConvertToSqlString2(Value), Record[3]) 1081 self.TblInf.Exec(SqlCommand) 1082 1083 ListMember = None 1084 if Type == TAB_GUIDS: 1085 ListMember = self.Module.Guids 1086 elif Type == TAB_PROTOCOLS: 1087 ListMember = self.Module.Protocols 1088 elif Type == TAB_PPIS: 1089 ListMember = self.Module.Ppis 1090 1091 for Key in Lists.keys(): 1092 ListClass = GuidProtocolPpiCommonClass() 1093 ListClass.CName = Key[0] 1094 ListClass.SupArchList = Lists[Key] 1095 ListClass.FeatureFlag = Key[1] 1096 ListMember.append(ListClass) 1097 1098## 1099# 1100# This acts like the main() function for the script, unless it is 'import'ed into another 1101# script. 1102# 1103if __name__ == '__main__': 1104 EdkLogger.Initialize() 1105 EdkLogger.SetLevel(EdkLogger.DEBUG_0) 1106 1107 W = os.getenv('WORKSPACE') 1108 F = os.path.join(W, 'MdeModulePkg/Application/HelloWorld/HelloWorld.inf') 1109 1110 Db = Database.Database('Inf.db') 1111 Db.InitDatabase() 1112 1113 P = Inf(os.path.normpath(F), True, True, W, Db) 1114 P.ShowModule() 1115 1116 Db.Close() 1117