]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/InfClassObject.py
BaseTools: Add new RegExp for future use
[mirror_edk2.git] / BaseTools / Source / Python / Common / InfClassObject.py
index 0f2b5ca47d726985b0fad145ccf69c5c802af365..f24e4e41a0c1e36e5679cd54c9218a588a64a933 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to define each component of INF file\r
 #\r
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -14,7 +14,7 @@
 ##\r
 # Import Modules\r
 #\r
-import os\r
+import Common.LongFilePathOs as os\r
 import re\r
 import EdkLogger\r
 from CommonDataClass.CommonClass import LibraryClassClass\r
@@ -29,6 +29,7 @@ import GlobalData
 from Table.TableInf import TableInf\r
 import Database\r
 from Parsing import *\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
 \r
 #\r
 # Global variable\r
@@ -163,7 +164,7 @@ class InfObject(object):
 # @var KeyList:             To store value for KeyList, a list for all Keys used in Inf\r
 #\r
 class Inf(InfObject):\r
-    def __init__(self, Filename = None, IsToDatabase = False, IsToModule = False, WorkspaceDir = None, Database = None, SupArchList = DataType.ARCH_LIST):\r
+    def __init__(self, Filename=None, IsToDatabase=False, IsToModule=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST):\r
         self.Identification = Identification()\r
         self.Module = ModuleClass()\r
         self.UserExtensions = ''\r
@@ -353,10 +354,10 @@ class Inf(InfObject):
             # Remove comment block\r
             #\r
             if Line.find(TAB_COMMENT_EDK_START) > -1:\r
-                ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]\r
+                ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]\r
                 IsFindBlockComment = True\r
             if Line.find(TAB_COMMENT_EDK_END) > -1:\r
-                Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]\r
+                Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]\r
                 ReservedLine = ''\r
                 IsFindBlockComment = False\r
             if IsFindBlockComment:\r
@@ -397,7 +398,7 @@ class Inf(InfObject):
                         CurrentSection = ItemList[0]\r
                     else:\r
                         if CurrentSection != ItemList[0]:\r
-                            EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)\r
+                            EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)\r
                     if CurrentSection.upper() not in self.KeyList:\r
                         RaiseParserError(Line, CurrentSection, Filename, '', LineNo)\r
                         CurrentSection = TAB_UNKNOWN\r
@@ -408,7 +409,7 @@ class Inf(InfObject):
                         RaiseParserError(Line, CurrentSection, Filename, '', LineNo)\r
                     else:\r
                         if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:\r
-                            EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)\r
+                            EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)\r
                         ArchList.append(ItemList[1].upper())\r
                         ThirdList.append(ItemList[2])\r
 \r
@@ -419,7 +420,7 @@ class Inf(InfObject):
             #\r
             if CurrentSection == TAB_UNKNOWN:\r
                 ErrorMsg = "%s is not in any defined section" % Line\r
-                EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)\r
+                EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)\r
 \r
             #\r
             # Add a section item\r
@@ -497,13 +498,13 @@ class Inf(InfObject):
             print Item.Name, Item.Value, Item.SupArchList\r
         print '\nPcds =', M.PcdCodes\r
         for Item in M.PcdCodes:\r
-            print '\tCName=',Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList\r
+            print '\tCName=', Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList\r
         print '\nSources =', M.Sources\r
         for Source in M.Sources:\r
             print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList\r
         print '\nUserExtensions =', M.UserExtensions\r
         for UserExtension in M.UserExtensions:\r
-            print UserExtension.UserID, UserExtension.Identifier,UserExtension.Content\r
+            print UserExtension.UserID, UserExtension.Identifier, UserExtension.Content\r
         print '\nGuids =', M.Guids\r
         for Item in M.Guids:\r
             print Item.CName, Item.SupArchList, Item.FeatureFlag\r
@@ -629,7 +630,7 @@ class Inf(InfObject):
                 if ModuleHeader.ComponentType in gComponentType2ModuleType:\r
                     ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType]\r
                 elif ModuleHeader.ComponentType != '':\r
-                    EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError = EdkLogger.IsRaiseError)\r
+                    EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError=EdkLogger.IsRaiseError)\r
 \r
             self.Module.Header[Arch] = ModuleHeader\r
 \r