]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - BaseTools/Source/Python/GenFds/UiSection.py
There is a limitation on WINDOWS OS for the length of entire file path can’t be large...
[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 - 2014, Intel Corporation. All rights reserved.<BR>\r
5#\r
6# This program and the accompanying materials\r
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
18import Section\r
19from Ffs import Ffs\r
20import subprocess\r
21import Common.LongFilePathOs as os\r
22from GenFdsGlobalVariable import GenFdsGlobalVariable\r
23from CommonDataClass.FdfClass import UiSectionClassObject\r
24from Common.LongFilePathSupport import OpenLongFilePath as open\r
25\r
26## generate UI section\r
27#\r
28#\r
29class UiSection (UiSectionClassObject):\r
30\r
31 ## The constructor\r
32 #\r
33 # @param self The object pointer\r
34 #\r
35 def __init__(self):\r
36 UiSectionClassObject.__init__(self)\r
37\r
38 ## GenSection() method\r
39 #\r
40 # Generate UI section\r
41 #\r
42 # @param self The object pointer\r
43 # @param OutputPath Where to place output file\r
44 # @param ModuleName Which module this section belongs to\r
45 # @param SecNum Index of section\r
46 # @param KeyStringList Filter for inputs of section generation\r
47 # @param FfsInf FfsInfStatement object that contains this section data\r
48 # @param Dict dictionary contains macro and its value\r
49 # @retval tuple (Generated file name, section alignment)\r
50 #\r
51 def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
52 #\r
53 # Prepare the parameter of GenSection\r
54 #\r
55 if FfsInf != None:\r
56 self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
57 self.StringData = FfsInf.__ExtendMacro__(self.StringData)\r
58 self.FileName = FfsInf.__ExtendMacro__(self.FileName)\r
59\r
60 OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('UI'))\r
61\r
62 if self.StringData != None :\r
63 NameString = self.StringData\r
64 elif self.FileName != None:\r
65 FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r
66 FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)\r
67 FileObj = open(FileNameStr, 'r')\r
68 NameString = FileObj.read()\r
69 NameString = '\"' + NameString + "\""\r
70 FileObj.close()\r
71 else:\r
72 NameString = ''\r
73\r
74 GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_USER_INTERFACE', Ui=NameString)\r
75\r
76 OutputFileList = []\r
77 OutputFileList.append(OutputFile)\r
78 return OutputFileList, self.Alignment\r