]>
Commit | Line | Data |
---|---|---|
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 |
40d841f6 | 6 | # This program and the accompanying materials\r |
30fdf114 LG |
7 | # are licensed and made available under the terms and conditions of the BSD License\r |
8 | # which accompanies this distribution. The full text of the license may be found at\r | |
9 | # http://opensource.org/licenses/bsd-license.php\r | |
10 | #\r | |
11 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | #\r | |
14 | \r | |
15 | ##\r | |
16 | # Import Modules\r | |
17 | #\r | |
18 | import Section\r | |
19 | from Ffs import Ffs\r | |
20 | import subprocess\r | |
1be2ed90 | 21 | import Common.LongFilePathOs as os\r |
30fdf114 LG |
22 | from GenFdsGlobalVariable import GenFdsGlobalVariable\r |
23 | from CommonDataClass.FdfClass import UiSectionClassObject\r | |
1be2ed90 | 24 | from Common.LongFilePathSupport import OpenLongFilePath as open\r |
91fa33ee | 25 | from Common.DataType import *\r |
30fdf114 LG |
26 | \r |
27 | ## generate UI section\r | |
28 | #\r | |
29 | #\r | |
30 | class UiSection (UiSectionClassObject):\r | |
31 | \r | |
32 | ## The constructor\r | |
33 | #\r | |
34 | # @param self The object pointer\r | |
35 | #\r | |
36 | def __init__(self):\r | |
37 | UiSectionClassObject.__init__(self)\r | |
38 | \r | |
39 | ## GenSection() method\r | |
40 | #\r | |
41 | # Generate UI section\r | |
42 | #\r | |
43 | # @param self The object pointer\r | |
44 | # @param OutputPath Where to place output file\r | |
45 | # @param ModuleName Which module this section belongs to\r | |
46 | # @param SecNum Index of section\r | |
47 | # @param KeyStringList Filter for inputs of section generation\r | |
48 | # @param FfsInf FfsInfStatement object that contains this section data\r | |
49 | # @param Dict dictionary contains macro and its value\r | |
50 | # @retval tuple (Generated file name, section alignment)\r | |
51 | #\r | |
37de70b7 | 52 | def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict={}, IsMakefile = False):\r |
30fdf114 LG |
53 | #\r |
54 | # Prepare the parameter of GenSection\r | |
55 | #\r | |
4231a819 | 56 | if FfsInf is not None:\r |
30fdf114 LG |
57 | self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r |
58 | self.StringData = FfsInf.__ExtendMacro__(self.StringData)\r | |
59 | self.FileName = FfsInf.__ExtendMacro__(self.FileName)\r | |
60 | \r | |
91fa33ee | 61 | OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(BINARY_FILE_TYPE_UI))\r |
30fdf114 | 62 | \r |
4231a819 | 63 | if self.StringData is not None :\r |
30fdf114 | 64 | NameString = self.StringData\r |
4231a819 | 65 | elif self.FileName is not None:\r |
30fdf114 LG |
66 | FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r |
67 | FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)\r | |
68 | FileObj = open(FileNameStr, 'r')\r | |
69 | NameString = FileObj.read()\r | |
30fdf114 LG |
70 | FileObj.close()\r |
71 | else:\r | |
72 | NameString = ''\r | |
37de70b7 | 73 | GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_USER_INTERFACE', Ui=NameString, IsMakefile=IsMakefile)\r |
30fdf114 LG |
74 | \r |
75 | OutputFileList = []\r | |
76 | OutputFileList.append(OutputFile)\r | |
77 | return OutputFileList, self.Alignment\r |