]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - BaseTools/Source/Python/GenFds/UiSection.py
BaseTools:change some incorrect parameter defaults
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / UiSection.py
... / ...
CommitLineData
1## @file\r
2# process UI section generation\r
3#\r
4# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
5#\r
6# SPDX-License-Identifier: BSD-2-Clause-Patent\r
7#\r
8\r
9##\r
10# Import Modules\r
11#\r
12from __future__ import absolute_import\r
13from . import Section\r
14from .Ffs import SectionSuffix\r
15import subprocess\r
16import Common.LongFilePathOs as os\r
17from .GenFdsGlobalVariable import GenFdsGlobalVariable\r
18from CommonDataClass.FdfClass import UiSectionClassObject\r
19from Common.LongFilePathSupport import OpenLongFilePath as open\r
20from Common.DataType import *\r
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
47 def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict=None, IsMakefile = False):\r
48 #\r
49 # Prepare the parameter of GenSection\r
50 #\r
51 if FfsInf is not None:\r
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
56 OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + SectionSuffix.get(BINARY_FILE_TYPE_UI))\r
57\r
58 if self.StringData is not None :\r
59 NameString = self.StringData\r
60 elif self.FileName is not None:\r
61 if Dict is None:\r
62 Dict = {}\r
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
67 FileObj.close()\r
68 else:\r
69 NameString = ''\r
70 GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_USER_INTERFACE', Ui=NameString, IsMakefile=IsMakefile)\r
71\r
72 OutputFileList = []\r
73 OutputFileList.append(OutputFile)\r
74 return OutputFileList, self.Alignment\r