]>
Commit | Line | Data |
---|---|---|
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 | |
12 | from __future__ import absolute_import\r | |
13 | from . import Section\r | |
14 | from .Ffs import SectionSuffix\r | |
15 | import subprocess\r | |
16 | import Common.LongFilePathOs as os\r | |
17 | from .GenFdsGlobalVariable import GenFdsGlobalVariable\r | |
18 | from CommonDataClass.FdfClass import UiSectionClassObject\r | |
19 | from Common.LongFilePathSupport import OpenLongFilePath as open\r | |
20 | from Common.DataType import *\r | |
21 | \r | |
22 | ## generate UI section\r | |
23 | #\r | |
24 | #\r | |
25 | class 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={}, 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 | FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r | |
62 | FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)\r | |
63 | FileObj = open(FileNameStr, 'r')\r | |
64 | NameString = FileObj.read()\r | |
65 | FileObj.close()\r | |
66 | else:\r | |
67 | NameString = ''\r | |
68 | GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_USER_INTERFACE', Ui=NameString, IsMakefile=IsMakefile)\r | |
69 | \r | |
70 | OutputFileList = []\r | |
71 | OutputFileList.append(OutputFile)\r | |
72 | return OutputFileList, self.Alignment\r |