* [PATCH] GenCfgOpt.py: remove tailing space from output file
@ 2018-09-26 11:57 Chasel, Chiu
2018-09-27 0:39 ` Yao, Jiewen
0 siblings, 1 reply; 2+ messages in thread
From: Chasel, Chiu @ 2018-09-26 11:57 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Gao Liming, Zhu Yonghong, Chasel Chiu
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 <Jiewen.yao@intel.com>
Cc: Gao Liming <liming.gao@intel.com>
Cc: Zhu Yonghong <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
IntelFsp2Pkg/Tools/GenCfgOpt.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index c9b7bc5373..7e61b00ab8 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -1,6 +1,6 @@
## @ GenCfgOpt.py
#
-# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials are licensed and made available under
# the terms and conditions of the BSD License that accompanies this distribution.
# The full text of the license may be found at
@@ -976,6 +976,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
@@ -1175,7 +1182,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()
@@ -1220,7 +1227,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()
--
2.13.3.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] GenCfgOpt.py: remove tailing space from output file
2018-09-26 11:57 [PATCH] GenCfgOpt.py: remove tailing space from output file Chasel, Chiu
@ 2018-09-27 0:39 ` Yao, Jiewen
0 siblings, 0 replies; 2+ messages in thread
From: Yao, Jiewen @ 2018-09-27 0:39 UTC (permalink / raw)
To: Chiu, Chasel, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong
Reviewed-by: jiewen.yao@intel.com
> -----Original Message-----
> From: Chiu, Chasel
> Sent: Wednesday, September 26, 2018 7:58 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Chiu,
> Chasel <chasel.chiu@intel.com>
> Subject: [PATCH] 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 <Jiewen.yao@intel.com>
> Cc: Gao Liming <liming.gao@intel.com>
> Cc: Zhu Yonghong <yonghong.zhu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> ---
> IntelFsp2Pkg/Tools/GenCfgOpt.py | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py
> b/IntelFsp2Pkg/Tools/GenCfgOpt.py
> index c9b7bc5373..7e61b00ab8 100644
> --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
> +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
> @@ -1,6 +1,6 @@
> ## @ GenCfgOpt.py
> #
> -# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
> # This program and the accompanying materials are licensed and made
> available under
> # the terms and conditions of the BSD License that accompanies this
> distribution.
> # The full text of the license may be found at
> @@ -976,6 +976,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
>
> @@ -1175,7 +1182,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()
> @@ -1220,7 +1227,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()
> --
> 2.13.3.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-27 0:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-26 11:57 [PATCH] GenCfgOpt.py: remove tailing space from output file Chasel, Chiu
2018-09-27 0:39 ` Yao, Jiewen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox