From f7496d717357b9af78414d19679b073403812340 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Thu, 5 Jul 2018 17:40:04 +0800 Subject: BaseTools: Clean up source files 1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao Cc: Yonghong Zhu Reviewed-by: Yonghong Zhu --- .../Python/UPT/Object/Parser/InfPackagesObject.py | 96 +++++++++++----------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py') diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py index bfac2b6b57..b2ca573549 100644 --- a/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py +++ b/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py @@ -1,12 +1,12 @@ ## @file -# This file is used to define class objects of INF file [Packages] section. -# It will consumed by InfParser. +# This file is used to define class objects of INF file [Packages] section. +# It will consumed by InfParser. # -# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
# -# 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 +# 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 # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, @@ -19,14 +19,14 @@ InfPackageObject from Logger import StringTable as ST from Logger import ToolError import Logger.Log as Logger -from Library import GlobalData +from Library import GlobalData from Library.Misc import Sdict from Library.ParserValidate import IsValidPath -from Library.ExpressionValidate import IsValidFeatureFlagExp +from Library.ExpressionValidate import IsValidFeatureFlagExp class InfPackageItem(): - def __init__(self, + def __init__(self, PackageName = '', FeatureFlagExp = '', HelpString = ''): @@ -34,28 +34,28 @@ class InfPackageItem(): self.FeatureFlagExp = FeatureFlagExp self.HelpString = HelpString self.SupArchList = [] - + def SetPackageName(self, PackageName): self.PackageName = PackageName def GetPackageName(self): return self.PackageName - + def SetFeatureFlagExp(self, FeatureFlagExp): self.FeatureFlagExp = FeatureFlagExp def GetFeatureFlagExp(self): return self.FeatureFlagExp - + def SetHelpString(self, HelpString): self.HelpString = HelpString def GetHelpString(self): return self.HelpString - + def SetSupArchList(self, SupArchList): self.SupArchList = SupArchList def GetSupArchList(self): return self.SupArchList - + ## INF package section # # @@ -67,18 +67,18 @@ class InfPackageObject(): # Macro defined in this section should be only used in this section. # self.Macros = {} - + def SetPackages(self, PackageData, Arch = None): IsValidFileFlag = False SupArchList = [] for ArchItem in Arch: # # Validate Arch - # + # if (ArchItem == '' or ArchItem is None): ArchItem = 'COMMON' - SupArchList.append(ArchItem) - + SupArchList.append(ArchItem) + for PackageItem in PackageData: PackageItemObj = InfPackageItem() HelpStringObj = PackageItem[1] @@ -86,7 +86,7 @@ class InfPackageObject(): PackageItem = PackageItem[0] if HelpStringObj is not None: HelpString = HelpStringObj.HeaderComments + HelpStringObj.TailComments - PackageItemObj.SetHelpString(HelpString) + PackageItemObj.SetHelpString(HelpString) if len(PackageItem) >= 1: # # Validate file exist/format. @@ -94,67 +94,67 @@ class InfPackageObject(): if IsValidPath(PackageItem[0], ''): IsValidFileFlag = True elif IsValidPath(PackageItem[0], GlobalData.gINF_MODULE_DIR): - IsValidFileFlag = True + IsValidFileFlag = True elif IsValidPath(PackageItem[0], GlobalData.gWORKSPACE): IsValidFileFlag = True else: - Logger.Error("InfParser", + Logger.Error("InfParser", ToolError.FORMAT_INVALID, ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(PackageItem[0]), - File=CurrentLineOfPackItem[2], - Line=CurrentLineOfPackItem[1], + File=CurrentLineOfPackItem[2], + Line=CurrentLineOfPackItem[1], ExtraData=CurrentLineOfPackItem[0]) return False - if IsValidFileFlag: + if IsValidFileFlag: PackageItemObj.SetPackageName(PackageItem[0]) if len(PackageItem) == 2: # # Validate Feature Flag Express # if PackageItem[1].strip() == '': - Logger.Error("InfParser", - ToolError.FORMAT_INVALID, + Logger.Error("InfParser", + ToolError.FORMAT_INVALID, ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING, - File=CurrentLineOfPackItem[2], - Line=CurrentLineOfPackItem[1], + File=CurrentLineOfPackItem[2], + Line=CurrentLineOfPackItem[1], ExtraData=CurrentLineOfPackItem[0]) # - # Validate FFE + # Validate FFE # FeatureFlagRtv = IsValidFeatureFlagExp(PackageItem[1].strip()) if not FeatureFlagRtv[0]: - Logger.Error("InfParser", + Logger.Error("InfParser", ToolError.FORMAT_INVALID, ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]), - File=CurrentLineOfPackItem[2], - Line=CurrentLineOfPackItem[1], + File=CurrentLineOfPackItem[2], + Line=CurrentLineOfPackItem[1], ExtraData=CurrentLineOfPackItem[0]) - + PackageItemObj.SetFeatureFlagExp(PackageItem[1].strip()) - + if len(PackageItem) > 2: # - # Invalid format of Package statement + # Invalid format of Package statement # - Logger.Error("InfParser", - ToolError.FORMAT_INVALID, + Logger.Error("InfParser", + ToolError.FORMAT_INVALID, ST.ERR_INF_PARSER_PACKAGE_SECTION_CONTENT_ERROR, - File=CurrentLineOfPackItem[2], - Line=CurrentLineOfPackItem[1], + File=CurrentLineOfPackItem[2], + Line=CurrentLineOfPackItem[1], ExtraData=CurrentLineOfPackItem[0]) PackageItemObj.SetSupArchList(SupArchList) - + # # Determine package file name duplicate. Follow below rule: # - # A package filename must not be duplicated within a [Packages] - # section. Package filenames may appear in multiple architectural - # [Packages] sections. A package filename listed in an + # A package filename must not be duplicated within a [Packages] + # section. Package filenames may appear in multiple architectural + # [Packages] sections. A package filename listed in an # architectural [Packages] section must not be listed in the common # architectural [Packages] section. - # + # # NOTE: This check will not report error now. - # + # for Item in self.Packages: if Item.GetPackageName() == PackageItemObj.GetPackageName(): ItemSupArchList = Item.GetSupArchList() @@ -170,7 +170,7 @@ class InfPackageObject(): # ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON # pass - + if (PackageItemObj) in self.Packages: PackageList = self.Packages[PackageItemObj] PackageList.append(PackageItemObj) @@ -179,9 +179,9 @@ class InfPackageObject(): PackageList = [] PackageList.append(PackageItemObj) self.Packages[PackageItemObj] = PackageList - + return True - + def GetPackages(self, Arch = None): if Arch is None: return self.Packages -- cgit v1.2.3