## @file
# This file is used to provide method for process AsBuilt INF file. It will consumed by InfParser
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
'''
InfAsBuiltProcess
'''
## Import modules
#
import os
import re
## GetLibInstanceInfo
#
# Get the information from Library Instance INF file.
#
# @param string. A string start with # and followed by INF file path
# @param WorkSpace. The WorkSpace directory used to combined with INF file path.
#
# @return GUID, Version
FileGuidString = ""
VerString = ""
if not String:
return None, None
#
# Remove "#" characters at the beginning
#
for Line in FileLinesList:
if FileGuidString:
if VerString:
return FileGuidString, VerString
## GetPackageListInfo
#
# Get the package information from INF file.
#
# @param string. A string start with # and followed by INF file path
# @param WorkSpace. The WorkSpace directory used to combined with INF file path.
#
# @return GUID, Version
PackageInfoList = []
DefineSectionMacros = {}
PackageSectionMacros = {}
LineNo = -1
for Line in FileLinesList:
LineNo += 1
continue
if not Line:
continue
#
# Found [Packages] section
#
continue
#
# Found [Define] section
#
continue
if DefineHeaderFlag:
#
# Find Macro
#
if Name != None:
continue
if PackageHederFlag:
#
# Find Macro
#
if Name != None:
continue
#
# Replace with Local section Macro and [Defines] section Macro.
#
Line = InfExpandMacro(Line, (FileNameString, Line, LineNo), DefineSectionMacros, PackageSectionMacros, True)
return PackageInfoList
if not LineNo:
LineNo = -1
#
# Validate file name exist.
#
if not (ValidFile(FullFileName)):
#
#
else:
return False
FileLinesList = []
if IsValidFileFlag:
try:
try:
except BaseException:
finally:
except BaseException:
return FileLinesList