BaseTools: Fix FDF file parse !include file issue
authorYunhua Feng <yunhuax.feng@intel.com>
Wed, 28 Jun 2017 10:29:18 +0000 (18:29 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Mon, 10 Jul 2017 01:59:16 +0000 (09:59 +0800)
when FDF file use "!include" format to include the other file,
and the end line of the file not end with '\n', the include
file parse error.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/GenFds/FdfParser.py

index 2782be4b984956b5ed703814789965f69a7014a3..8f49f9faad7a4c7cd564ac260f82a9052c3aa3a0 100644 (file)
@@ -167,6 +167,10 @@ class IncludeFileProfile :
             fsock = open(FileName, "rb", 0)\r
             try:\r
                 self.FileLinesList = fsock.readlines()\r
+                for index, line in enumerate(self.FileLinesList):\r
+                    if not line.endswith('\n'):\r
+                        self.FileLinesList[index] += '\n'\r
+\r
             finally:\r
                 fsock.close()\r
 \r