Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

88 lines
2.7 KiB
Python
Raw Permalink Normal View History

## @file
2018-07-05 17:40:04 +08:00
# This file is used to define class objects of INF file [BuildOptions] section.
# It will consumed by InfParser.
#
2018-07-05 17:40:04 +08:00
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
'''
InfBuildOptionObject
'''
2018-07-05 17:40:04 +08:00
from Library import GlobalData
from Object.Parser.InfCommonObject import InfSectionCommonDef
class InfBuildOptionItem():
def __init__(self):
self.Content = ''
self.SupArchList = []
self.AsBuildList = []
2018-07-05 17:40:04 +08:00
def SetContent(self, Content):
self.Content = Content
def GetContent(self):
return self.Content
2018-07-05 17:40:04 +08:00
def SetSupArchList(self, SupArchList):
self.SupArchList = SupArchList
def GetSupArchList(self):
return self.SupArchList
2018-07-05 17:40:04 +08:00
#
# AsBuild Information
#
def SetAsBuildList(self, AsBuildList):
self.AsBuildList = AsBuildList
def GetAsBuildList(self):
return self.AsBuildList
2018-07-05 17:40:04 +08:00
## INF BuildOption section
# Macro define is not permitted for this section.
#
2018-07-05 17:40:04 +08:00
#
class InfBuildOptionsObject(InfSectionCommonDef):
def __init__(self):
self.BuildOptions = []
InfSectionCommonDef.__init__(self)
## SetBuildOptions function
#
2019-07-04 19:43:48 +08:00
# For BuildOptionName, need to validate its format
2018-07-05 17:40:04 +08:00
# For BuildOptionValue, just ignore it.
#
# @param Arch Indicated which arch of build options belong to.
# @param BuildOptCont A list contain BuildOption related information.
# The element in the list contain 3 members.
# BuildOptionName, BuildOptionValue and IsReplace
# flag.
2018-07-05 17:40:04 +08:00
#
# @return True Build options set/validate successfully
# @return False Build options set/validate failed
#
def SetBuildOptions(self, BuildOptCont, ArchList = None, SectionContent = ''):
2018-07-05 17:40:04 +08:00
if not GlobalData.gIS_BINARY_INF:
if SectionContent.strip() != '':
InfBuildOptionItemObj = InfBuildOptionItem()
InfBuildOptionItemObj.SetContent(SectionContent)
InfBuildOptionItemObj.SetSupArchList(ArchList)
2018-07-05 17:40:04 +08:00
self.BuildOptions.append(InfBuildOptionItemObj)
else:
#
2018-07-05 17:40:04 +08:00
# For AsBuild INF file
#
if len(BuildOptCont) >= 1:
InfBuildOptionItemObj = InfBuildOptionItem()
InfBuildOptionItemObj.SetAsBuildList(BuildOptCont)
2014-08-26 05:58:02 +00:00
InfBuildOptionItemObj.SetSupArchList(ArchList)
self.BuildOptions.append(InfBuildOptionItemObj)
2018-07-05 17:40:04 +08:00
return True
2018-07-05 17:40:04 +08:00
def GetBuildOptions(self):
2018-07-05 17:40:04 +08:00
return self.BuildOptions