mirror of
https://github.com/utmapp/edk2.git
synced 2026-12-01 14:00:40 -10:00
GenCfgOpt.py: remove tailing space from output file
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1212 UPD header files generated by GenCfgOpt.py may have tailing white space from some of the UPD description in DSC, especially when python script automatically switching lines for long description string. This patch will always remove tailing white space for UPD header files. Test: Verified the patch can remove tailing space in output header files when UPD DSC contains intentional tailing white space. Cc: Jiewen Yao <[email protected]> Cc: Gao Liming <[email protected]> Cc: Zhu Yonghong <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu <[email protected]> Reviewed-by: Jiewen Yao <[email protected]>
This commit is contained in:
1 parent
29933058fc
commit
737f812b00
1 file changed
+9
-2
@@ -1038,6 +1038,13 @@ EndList
|
||||
NewTextBody.extend(OldTextBody)
|
||||
return NewTextBody
|
||||
|
||||
def WriteLinesWithoutTailingSpace (self, HeaderFd, Line):
|
||||
TxtBody2 = Line.splitlines(True)
|
||||
for Line2 in TxtBody2:
|
||||
Line2 = Line2.rstrip()
|
||||
Line2 += '\n'
|
||||
HeaderFd.write (Line2)
|
||||
return 0
|
||||
def CreateHeaderFile (self, InputHeaderFile):
|
||||
FvDir = self._FvDir
|
||||
|
||||
@@ -1237,7 +1244,7 @@ EndList
|
||||
Index += 1
|
||||
for Item in range(len(StructStart)):
|
||||
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
|
||||
HeaderFd.write (Line)
|
||||
self.WriteLinesWithoutTailingSpace(HeaderFd, Line)
|
||||
HeaderFd.write("#pragma pack()\n\n")
|
||||
HeaderFd.write("#endif\n")
|
||||
HeaderFd.close()
|
||||
@@ -1282,7 +1289,7 @@ EndList
|
||||
Index += 1
|
||||
for Item in range(len(StructStart)):
|
||||
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
|
||||
HeaderFd.write (Line)
|
||||
self.WriteLinesWithoutTailingSpace(HeaderFd, Line)
|
||||
HeaderFd.write("#pragma pack()\n\n")
|
||||
HeaderFd.write("#endif\n")
|
||||
HeaderFd.close()
|
||||
|
||||
Reference in new issue
Block a user