]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/FdfParserLite.py
BaseTools: Enhance the report to not show the empty section
[mirror_edk2.git] / BaseTools / Source / Python / Common / FdfParserLite.py
index 031dc15bc7665b8cab3de77b574a999202ffb098..a8cce261202efe4eaf3e74a069f919c07ebf7f6e 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # parse FDF 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
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 # Import Modules\r
 #\r
 import re\r
-import os\r
+import Common.LongFilePathOs as os\r
 \r
 import CommonDataClass.FdfClass\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
 \r
 ##define T_CHAR_SPACE                ' '\r
 ##define T_CHAR_NULL                 '\0'\r
@@ -67,8 +69,8 @@ class Warning (Exception):
     #   @param  File        The FDF name\r
     #   @param  Line        The Line number that error occurs\r
     #\r
-    def __init__(self, Str, File = None, Line = None):\r
-        \r
+    def __init__(self, Str, File=None, Line=None):\r
+\r
         FileLineTuple = GetRealFileLine(File, Line)\r
         self.FileName = FileLineTuple[0]\r
         self.LineNumber = FileLineTuple[1]\r
@@ -357,8 +359,8 @@ class FdfParser(object):
             else:\r
                 raise Warning("Macro not complete At Line ", self.FileName, self.CurrentLineNumber)\r
         return Str\r
-    \r
-    def __ReplaceFragment(self, StartPos, EndPos, Value = ' '):\r
+\r
+    def __ReplaceFragment(self, StartPos, EndPos, Value=' '):\r
         if StartPos[0] == EndPos[0]:\r
             Offset = StartPos[1]\r
             while Offset <= EndPos[1]:\r
@@ -484,7 +486,8 @@ class FdfParser(object):
                 IncFileName = self.__Token\r
                 if not os.path.isabs(IncFileName):\r
                     if IncFileName.startswith('$(WORKSPACE)'):\r
-                        Str = IncFileName.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))\r
+                        Str = mws.handleWsMacro(IncFileName)\r
+                        Str = Str.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))\r
                         if os.path.exists(Str):\r
                             if not os.path.isabs(Str):\r
                                 Str = os.path.abspath(Str)\r
@@ -493,7 +496,7 @@ class FdfParser(object):
                         # file is in the same dir with FDF file\r
                         FullFdf = self.FileName\r
                         if not os.path.isabs(self.FileName):\r
-                            FullFdf = os.path.join(os.environ.get('WORKSPACE'), self.FileName)\r
+                            FullFdf = mws.join(os.environ.get('WORKSPACE'), self.FileName)\r
                 \r
                         IncFileName = os.path.join(os.path.dirname(FullFdf), IncFileName)\r
                     \r