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