]>
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 # SPDX-License-Identifier: BSD-2-Clause-Patent
13 from Library
import GlobalData
15 from Object
.Parser
.InfCommonObject
import InfSectionCommonDef
17 class InfBuildOptionItem():
23 def SetContent(self
, Content
):
24 self
.Content
= Content
28 def SetSupArchList(self
, SupArchList
):
29 self
.SupArchList
= SupArchList
30 def GetSupArchList(self
):
31 return self
.SupArchList
36 def SetAsBuildList(self
, AsBuildList
):
37 self
.AsBuildList
= AsBuildList
38 def GetAsBuildList(self
):
39 return self
.AsBuildList
42 ## INF BuildOption section
43 # Macro define is not permitted for this section.
46 class InfBuildOptionsObject(InfSectionCommonDef
):
48 self
.BuildOptions
= []
49 InfSectionCommonDef
.__init
__(self
)
50 ## SetBuildOptions function
52 # For BuildOptionName, need to validate its format
53 # For BuildOptionValue, just ignore it.
55 # @param Arch Indicated which arch of build options belong to.
56 # @param BuildOptCont A list contain BuildOption related information.
57 # The element in the list contain 3 members.
58 # BuildOptionName, BuildOptionValue and IsReplace
61 # @return True Build options set/validate successfully
62 # @return False Build options set/validate failed
64 def SetBuildOptions(self
, BuildOptCont
, ArchList
= None, SectionContent
= ''):
66 if not GlobalData
.gIS_BINARY_INF
:
68 if SectionContent
.strip() != '':
69 InfBuildOptionItemObj
= InfBuildOptionItem()
70 InfBuildOptionItemObj
.SetContent(SectionContent
)
71 InfBuildOptionItemObj
.SetSupArchList(ArchList
)
73 self
.BuildOptions
.append(InfBuildOptionItemObj
)
76 # For AsBuild INF file
78 if len(BuildOptCont
) >= 1:
79 InfBuildOptionItemObj
= InfBuildOptionItem()
80 InfBuildOptionItemObj
.SetAsBuildList(BuildOptCont
)
81 InfBuildOptionItemObj
.SetSupArchList(ArchList
)
82 self
.BuildOptions
.append(InfBuildOptionItemObj
)
86 def GetBuildOptions(self
):
87 return self
.BuildOptions