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