]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/GenFds/UiSection.py
2 # process UI section generation
4 # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
12 from __future__
import absolute_import
14 from .Ffs
import SectionSuffix
16 import Common
.LongFilePathOs
as os
17 from .GenFdsGlobalVariable
import GenFdsGlobalVariable
18 from CommonDataClass
.FdfClass
import UiSectionClassObject
19 from Common
.LongFilePathSupport
import OpenLongFilePath
as open
20 from Common
.DataType
import *
22 ## generate UI section
25 class UiSection (UiSectionClassObject
):
29 # @param self The object pointer
32 UiSectionClassObject
.__init
__(self
)
34 ## GenSection() method
38 # @param self The object pointer
39 # @param OutputPath Where to place output file
40 # @param ModuleName Which module this section belongs to
41 # @param SecNum Index of section
42 # @param KeyStringList Filter for inputs of section generation
43 # @param FfsInf FfsInfStatement object that contains this section data
44 # @param Dict dictionary contains macro and its value
45 # @retval tuple (Generated file name, section alignment)
47 def GenSection(self
, OutputPath
, ModuleName
, SecNum
, KeyStringList
, FfsInf
=None, Dict
=None, IsMakefile
= False):
49 # Prepare the parameter of GenSection
51 if FfsInf
is not None:
52 self
.Alignment
= FfsInf
.__ExtendMacro
__(self
.Alignment
)
53 self
.StringData
= FfsInf
.__ExtendMacro
__(self
.StringData
)
54 self
.FileName
= FfsInf
.__ExtendMacro
__(self
.FileName
)
56 OutputFile
= os
.path
.join(OutputPath
, ModuleName
+ SUP_MODULE_SEC
+ SecNum
+ SectionSuffix
.get(BINARY_FILE_TYPE_UI
))
58 if self
.StringData
is not None :
59 NameString
= self
.StringData
60 elif self
.FileName
is not None:
63 FileNameStr
= GenFdsGlobalVariable
.ReplaceWorkspaceMacro(self
.FileName
)
64 FileNameStr
= GenFdsGlobalVariable
.MacroExtend(FileNameStr
, Dict
)
65 FileObj
= open(FileNameStr
, 'r')
66 NameString
= FileObj
.read()
70 GenFdsGlobalVariable
.GenerateSection(OutputFile
, None, 'EFI_SECTION_USER_INTERFACE', Ui
=NameString
, IsMakefile
=IsMakefile
)
73 OutputFileList
.append(OutputFile
)
74 return OutputFileList
, self
.Alignment