]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/UPT/Object/Parser/InfBuildOptionObject.py
2 # This file is used to define class objects of INF file [BuildOptions] section.
3 # It will consumed by InfParser.
5 # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
7 # This program and the accompanying materials are licensed and made available
8 # under the terms and conditions of the BSD License which accompanies this
9 # distribution. The full text of the license may be found at
10 # http://opensource.org/licenses/bsd-license.php
12 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 from Library
import GlobalData
21 from Object
.Parser
.InfCommonObject
import InfSectionCommonDef
23 class InfBuildOptionItem():
29 def SetContent(self
, Content
):
30 self
.Content
= Content
34 def SetSupArchList(self
, SupArchList
):
35 self
.SupArchList
= SupArchList
36 def GetSupArchList(self
):
37 return self
.SupArchList
42 def SetAsBuildList(self
, AsBuildList
):
43 self
.AsBuildList
= AsBuildList
44 def GetAsBuildList(self
):
45 return self
.AsBuildList
48 ## INF BuildOption section
49 # Macro define is not permitted for this section.
52 class InfBuildOptionsObject(InfSectionCommonDef
):
54 self
.BuildOptions
= []
55 InfSectionCommonDef
.__init
__(self
)
56 ## SetBuildOptions function
58 # For BuildOptionName, need to validate it's format
59 # For BuildOptionValue, just ignore it.
61 # @param Arch Indicated which arch of build options belong to.
62 # @param BuildOptCont A list contain BuildOption related information.
63 # The element in the list contain 3 members.
64 # BuildOptionName, BuildOptionValue and IsReplace
67 # @return True Build options set/validate successfully
68 # @return False Build options set/validate failed
70 def SetBuildOptions(self
, BuildOptCont
, ArchList
= None, SectionContent
= ''):
72 if not GlobalData
.gIS_BINARY_INF
:
74 if SectionContent
.strip() != '':
75 InfBuildOptionItemObj
= InfBuildOptionItem()
76 InfBuildOptionItemObj
.SetContent(SectionContent
)
77 InfBuildOptionItemObj
.SetSupArchList(ArchList
)
79 self
.BuildOptions
.append(InfBuildOptionItemObj
)
82 # For AsBuild INF file
84 if len(BuildOptCont
) >= 1:
85 InfBuildOptionItemObj
= InfBuildOptionItem()
86 InfBuildOptionItemObj
.SetAsBuildList(BuildOptCont
)
87 InfBuildOptionItemObj
.SetSupArchList(ArchList
)
88 self
.BuildOptions
.append(InfBuildOptionItemObj
)
92 def GetBuildOptions(self
):
93 return self
.BuildOptions