]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/GenFds/UiSection.py
BaseTools:change some incorrect parameter defaults
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / UiSection.py
CommitLineData
30fdf114
LG
1## @file\r
2# process UI section generation\r
3#\r
1e892df6 4# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
30fdf114 5#\r
2e351cbe 6# SPDX-License-Identifier: BSD-2-Clause-Patent\r
30fdf114
LG
7#\r
8\r
9##\r
10# Import Modules\r
11#\r
1ccc4d89 12from __future__ import absolute_import\r
bfa65b61 13from . import Section\r
9e47e6f9 14from .Ffs import SectionSuffix\r
30fdf114 15import subprocess\r
1be2ed90 16import Common.LongFilePathOs as os\r
bfa65b61 17from .GenFdsGlobalVariable import GenFdsGlobalVariable\r
30fdf114 18from CommonDataClass.FdfClass import UiSectionClassObject\r
1be2ed90 19from Common.LongFilePathSupport import OpenLongFilePath as open\r
91fa33ee 20from Common.DataType import *\r
30fdf114
LG
21\r
22## generate UI section\r
23#\r
24#\r
25class UiSection (UiSectionClassObject):\r
26\r
27 ## The constructor\r
28 #\r
29 # @param self The object pointer\r
30 #\r
31 def __init__(self):\r
32 UiSectionClassObject.__init__(self)\r
33\r
34 ## GenSection() method\r
35 #\r
36 # Generate UI section\r
37 #\r
38 # @param self The object pointer\r
39 # @param OutputPath Where to place output file\r
40 # @param ModuleName Which module this section belongs to\r
41 # @param SecNum Index of section\r
42 # @param KeyStringList Filter for inputs of section generation\r
43 # @param FfsInf FfsInfStatement object that contains this section data\r
44 # @param Dict dictionary contains macro and its value\r
45 # @retval tuple (Generated file name, section alignment)\r
46 #\r
e32f7bc9 47 def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict=None, IsMakefile = False):\r
30fdf114
LG
48 #\r
49 # Prepare the parameter of GenSection\r
50 #\r
4231a819 51 if FfsInf is not None:\r
30fdf114
LG
52 self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
53 self.StringData = FfsInf.__ExtendMacro__(self.StringData)\r
54 self.FileName = FfsInf.__ExtendMacro__(self.FileName)\r
55\r
9e47e6f9 56 OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + SectionSuffix.get(BINARY_FILE_TYPE_UI))\r
30fdf114 57\r
4231a819 58 if self.StringData is not None :\r
30fdf114 59 NameString = self.StringData\r
4231a819 60 elif self.FileName is not None:\r
e32f7bc9
FZ
61 if Dict is None:\r
62 Dict = {}\r
30fdf114
LG
63 FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r
64 FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)\r
65 FileObj = open(FileNameStr, 'r')\r
66 NameString = FileObj.read()\r
30fdf114
LG
67 FileObj.close()\r
68 else:\r
69 NameString = ''\r
37de70b7 70 GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_USER_INTERFACE', Ui=NameString, IsMakefile=IsMakefile)\r
30fdf114
LG
71\r
72 OutputFileList = []\r
73 OutputFileList.append(OutputFile)\r
74 return OutputFileList, self.Alignment\r