## @file\r
-# This file contained the parser for [Packages] sections in INF file \r
+# This file contained the parser for [Packages] sections in INF file\r
#\r
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
'''\r
InfPackageSectionParser\r
class InfPackageSectionParser(InfParserSectionRoot):\r
## InfPackageParser\r
#\r
- # \r
+ #\r
def InfPackageParser(self, SectionString, InfSectionObject, FileName):\r
#\r
- # Macro defined in this section \r
+ # Macro defined in this section\r
#\r
SectionMacros = {}\r
ValueList = []\r
PackageList = []\r
StillCommentFalg = False\r
HeaderComments = []\r
- LineComment = None \r
+ LineComment = None\r
#\r
# Parse section content\r
#\r
for Line in SectionString:\r
PkgLineContent = Line[0]\r
- PkgLineNo = Line[1] \r
- \r
+ PkgLineNo = Line[1]\r
+\r
if PkgLineContent.strip() == '':\r
continue\r
- \r
+\r
#\r
- # Find Header Comments \r
+ # Find Header Comments\r
#\r
if PkgLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):\r
#\r
HeaderComments.append(Line)\r
continue\r
#\r
- # First time encounter comment \r
+ # First time encounter comment\r
#\r
else:\r
#\r
continue\r
else:\r
StillCommentFalg = False\r
- \r
+\r
if len(HeaderComments) >= 1:\r
LineComment = InfLineCommentObject()\r
LineCommentContent = ''\r
for Item in HeaderComments:\r
LineCommentContent += Item[0] + DT.END_OF_LINE\r
LineComment.SetHeaderComments(LineCommentContent)\r
- \r
+\r
#\r
# Find Tail comment.\r
#\r
if PkgLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:\r
TailComments = PkgLineContent[PkgLineContent.find(DT.TAB_COMMENT_SPLIT):]\r
PkgLineContent = PkgLineContent[:PkgLineContent.find(DT.TAB_COMMENT_SPLIT)]\r
- if LineComment == None:\r
+ if LineComment is None:\r
LineComment = InfLineCommentObject()\r
- LineComment.SetTailComments(TailComments) \r
+ LineComment.SetTailComments(TailComments)\r
#\r
# Find Macro\r
#\r
FileName,\r
DT.MODEL_META_DATA_PACKAGE,\r
self.FileLocalMacros)\r
- if Name != None:\r
+ if Name is not None:\r
SectionMacros[Name] = Value\r
LineComment = None\r
- HeaderComments = [] \r
+ HeaderComments = []\r
continue\r
\r
TokenList = GetSplitValueList(PkgLineContent, DT.TAB_VALUE_SPLIT, 1)\r
ValueList[0:len(TokenList)] = TokenList\r
- \r
+\r
#\r
# Replace with Local section Macro and [Defines] section Macro.\r
- # \r
- ValueList = [InfExpandMacro(Value, (FileName, PkgLineContent, PkgLineNo), \r
+ #\r
+ ValueList = [InfExpandMacro(Value, (FileName, PkgLineContent, PkgLineNo),\r
self.FileLocalMacros, SectionMacros, True)\r
for Value in ValueList]\r
- \r
- PackageList.append((ValueList, LineComment, \r
+\r
+ PackageList.append((ValueList, LineComment,\r
(PkgLineContent, PkgLineNo, FileName)))\r
ValueList = []\r
LineComment = None\r
TailComments = ''\r
- HeaderComments = [] \r
+ HeaderComments = []\r
continue\r
\r
#\r
# Current section archs\r
- # \r
+ #\r
ArchList = []\r
for Item in self.LastSectionHeaderContent:\r
if Item[1] not in ArchList:\r
- ArchList.append(Item[1]) \r
- \r
+ ArchList.append(Item[1])\r
+\r
if not InfSectionObject.SetPackages(PackageList, Arch = ArchList):\r
- Logger.Error('InfParser', \r
- FORMAT_INVALID, \r
+ Logger.Error('InfParser',\r
+ FORMAT_INVALID,\r
ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR\\r
%("[Packages]"),\r
File=FileName,\r
- Line=Item[3])
\ No newline at end of file
+ Line=Item[3])\r