]>
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 # This program and the accompanying materials
7 # are licensed and made available under the terms and conditions of the BSD License
8 # which accompanies this distribution. The full text of the license may be found at
9 # http://opensource.org/licenses/bsd-license.php
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 from __future__
import absolute_import
22 import Common
.LongFilePathOs
as os
23 from .GenFdsGlobalVariable
import GenFdsGlobalVariable
24 from CommonDataClass
.FdfClass
import UiSectionClassObject
25 from Common
.LongFilePathSupport
import OpenLongFilePath
as open
26 from Common
.DataType
import *
28 ## generate UI section
31 class UiSection (UiSectionClassObject
):
35 # @param self The object pointer
38 UiSectionClassObject
.__init
__(self
)
40 ## GenSection() method
44 # @param self The object pointer
45 # @param OutputPath Where to place output file
46 # @param ModuleName Which module this section belongs to
47 # @param SecNum Index of section
48 # @param KeyStringList Filter for inputs of section generation
49 # @param FfsInf FfsInfStatement object that contains this section data
50 # @param Dict dictionary contains macro and its value
51 # @retval tuple (Generated file name, section alignment)
53 def GenSection(self
, OutputPath
, ModuleName
, SecNum
, KeyStringList
, FfsInf
=None, Dict
={}, IsMakefile
= False):
55 # Prepare the parameter of GenSection
57 if FfsInf
is not None:
58 self
.Alignment
= FfsInf
.__ExtendMacro
__(self
.Alignment
)
59 self
.StringData
= FfsInf
.__ExtendMacro
__(self
.StringData
)
60 self
.FileName
= FfsInf
.__ExtendMacro
__(self
.FileName
)
62 OutputFile
= os
.path
.join(OutputPath
, ModuleName
+ SUP_MODULE_SEC
+ SecNum
+ Ffs
.SectionSuffix
.get(BINARY_FILE_TYPE_UI
))
64 if self
.StringData
is not None :
65 NameString
= self
.StringData
66 elif self
.FileName
is not None:
67 FileNameStr
= GenFdsGlobalVariable
.ReplaceWorkspaceMacro(self
.FileName
)
68 FileNameStr
= GenFdsGlobalVariable
.MacroExtend(FileNameStr
, Dict
)
69 FileObj
= open(FileNameStr
, 'r')
70 NameString
= FileObj
.read()
74 GenFdsGlobalVariable
.GenerateSection(OutputFile
, None, 'EFI_SECTION_USER_INTERFACE', Ui
=NameString
, IsMakefile
=IsMakefile
)
77 OutputFileList
.append(OutputFile
)
78 return OutputFileList
, self
.Alignment