]> 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 e774d80d697b0489f3ce54fda35e0d7487e2003e..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
@@ -104,7 +105,7 @@ class InfHeader(ModuleHeaderClass):
         TAB_INF_DEFINES_VERSION_STRING              : "VersionString",\r
         TAB_INF_DEFINES_VERSION                     : "Version",\r
         TAB_INF_DEFINES_PCD_IS_DRIVER               : "PcdIsDriver",\r
-        TAB_INF_DEFINES_TIANO_R8_FLASHMAP_H         : "TianoR8FlashMap_h",\r
+        TAB_INF_DEFINES_TIANO_EDK_FLASHMAP_H         : "TianoEdkFlashMap_h",\r
         TAB_INF_DEFINES_SHADOW                      : "Shadow",\r
 #       TAB_INF_DEFINES_LIBRARY_CLASS               : "LibraryClass",\r
 #        TAB_INF_DEFINES_ENTRY_POINT                 : "ExternImages",\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
@@ -352,11 +353,11 @@ class Inf(InfObject):
             #\r
             # Remove comment block\r
             #\r
-            if Line.find(TAB_COMMENT_R8_START) > -1:\r
-                ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0]\r
+            if Line.find(TAB_COMMENT_EDK_START) > -1:\r
+                ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]\r
                 IsFindBlockComment = True\r
-            if Line.find(TAB_COMMENT_R8_END) > -1:\r
-                Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1]\r
+            if Line.find(TAB_COMMENT_EDK_END) > -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
@@ -465,7 +466,7 @@ class Inf(InfObject):
             print 'FvExt =', M.Header[Arch].FvExt\r
             print 'SourceFv =', M.Header[Arch].SourceFv\r
             print 'PcdIsDriver =', M.Header[Arch].PcdIsDriver\r
-            print 'TianoR8FlashMap_h =', M.Header[Arch].TianoR8FlashMap_h\r
+            print 'TianoEdkFlashMap_h =', M.Header[Arch].TianoEdkFlashMap_h\r
             print 'Shadow =', M.Header[Arch].Shadow\r
             print 'LibraryClass =', M.Header[Arch].LibraryClass\r
             for Item in M.Header[Arch].LibraryClass:\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
@@ -613,7 +614,7 @@ class Inf(InfObject):
             # Get version of INF\r
             #\r
             if ModuleHeader.InfVersion != "":\r
-                # R9 inf\r
+                # EdkII inf\r
                 VersionNumber = ModuleHeader.VersionNumber\r
                 VersionString = ModuleHeader.VersionString\r
                 if len(VersionNumber) > 0 and len(VersionString) == 0:\r
@@ -624,12 +625,12 @@ class Inf(InfObject):
                         EdkLogger.warn(2001, 'INF file %s defines both VERSION_NUMBER and VERSION_STRING, using VERSION_STRING' % self.Identification.FileFullPath)\r
                     ModuleHeader.Version = VersionString\r
             else:\r
-                # R8 inf\r
+                # Edk inf\r
                 ModuleHeader.InfVersion = "0x00010000"\r
                 if ModuleHeader.ComponentType in gComponentType2ModuleType:\r
                     ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType]\r
                 elif ModuleHeader.ComponentType != '':\r
-                    EdkLogger.error("Parser", PARSER_ERROR, "Unsupported R8 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
@@ -841,7 +842,7 @@ class Inf(InfObject):
             Nmake.SupArchList = Nmakes[Key]\r
             self.Module.Nmake.append(Nmake)\r
 \r
-            # convert R8 format to R9 format\r
+            # convert Edk format to EdkII format\r
             if Nmake.Name == "IMAGE_ENTRY_POINT":\r
                 Image = ModuleExternImageClass()\r
                 Image.ModuleEntryPoint = Nmake.Value\r