]>
Commit | Line | Data |
---|---|---|
4234283c LG |
1 | ## @file\r |
2 | # This file is used to define class objects of INF file [BuildOptions] section. \r | |
3 | # It will consumed by InfParser. \r | |
4 | #\r | |
5 | # Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r | |
6 | #\r | |
7 | # This program and the accompanying materials are licensed and made available \r | |
8 | # under the terms and conditions of the BSD License which accompanies this \r | |
9 | # distribution. The full text of the license may be found at \r | |
10 | # http://opensource.org/licenses/bsd-license.php\r | |
11 | #\r | |
12 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | '''\r | |
16 | InfBuildOptionObject\r | |
17 | '''\r | |
18 | \r | |
19 | from Library import GlobalData \r | |
20 | \r | |
21 | from Object.Parser.InfCommonObject import InfSectionCommonDef\r | |
22 | \r | |
23 | class InfBuildOptionItem():\r | |
24 | def __init__(self):\r | |
25 | self.Content = ''\r | |
26 | self.SupArchList = []\r | |
27 | self.AsBuildList = []\r | |
28 | \r | |
29 | def SetContent(self, Content):\r | |
30 | self.Content = Content\r | |
31 | def GetContent(self):\r | |
32 | return self.Content\r | |
33 | \r | |
34 | def SetSupArchList(self, SupArchList):\r | |
35 | self.SupArchList = SupArchList\r | |
36 | def GetSupArchList(self):\r | |
37 | return self.SupArchList\r | |
38 | \r | |
39 | #\r | |
40 | # AsBuild Information\r | |
41 | #\r | |
42 | def SetAsBuildList(self, AsBuildList):\r | |
43 | self.AsBuildList = AsBuildList\r | |
44 | def GetAsBuildList(self):\r | |
45 | return self.AsBuildList\r | |
46 | \r | |
47 | \r | |
48 | ## INF BuildOption section\r | |
49 | # Macro define is not permitted for this section.\r | |
50 | #\r | |
51 | # \r | |
52 | class InfBuildOptionsObject(InfSectionCommonDef):\r | |
53 | def __init__(self):\r | |
54 | self.BuildOptions = []\r | |
55 | InfSectionCommonDef.__init__(self)\r | |
56 | ## SetBuildOptions function\r | |
57 | #\r | |
58 | # For BuildOptionName, need to validate it's format\r | |
59 | # For BuildOptionValue, just ignore it. \r | |
60 | #\r | |
61 | # @param Arch Indicated which arch of build options belong to.\r | |
62 | # @param BuildOptCont A list contain BuildOption related information.\r | |
63 | # The element in the list contain 3 members.\r | |
64 | # BuildOptionName, BuildOptionValue and IsReplace\r | |
65 | # flag.\r | |
66 | # \r | |
67 | # @return True Build options set/validate successfully\r | |
68 | # @return False Build options set/validate failed\r | |
69 | #\r | |
70 | def SetBuildOptions(self, BuildOptCont, ArchList = None, SectionContent = ''):\r | |
71 | \r | |
72 | if not GlobalData.gIS_BINARY_INF: \r | |
73 | \r | |
74 | if SectionContent.strip() != '':\r | |
75 | InfBuildOptionItemObj = InfBuildOptionItem()\r | |
76 | InfBuildOptionItemObj.SetContent(SectionContent)\r | |
77 | InfBuildOptionItemObj.SetSupArchList(ArchList)\r | |
78 | \r | |
79 | self.BuildOptions.append(InfBuildOptionItemObj)\r | |
80 | else:\r | |
81 | #\r | |
82 | # For AsBuild INF file \r | |
83 | #\r | |
84 | if len(BuildOptCont) >= 1:\r | |
85 | InfBuildOptionItemObj = InfBuildOptionItem()\r | |
86 | InfBuildOptionItemObj.SetAsBuildList(BuildOptCont)\r | |
87 | self.BuildOptions.append(InfBuildOptionItemObj)\r | |
88 | \r | |
89 | \r | |
90 | return True\r | |
91 | \r | |
92 | def GetBuildOptions(self):\r | |
93 | return self.BuildOptions |