From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: "Sun, Yanyan" <yanyan.sun@intel.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>,
"Zhu, Yonghong" <yonghong.zhu@intel.com>
Subject: Re: [Patch] BaseTools/BinToPcd: Open output file as text file
Date: Mon, 6 Aug 2018 02:29:35 +0000 [thread overview]
Message-ID: <B9726D6DCCFB8B4CA276A9169B02216D520CD286@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <CB4A686B405FEF49A15CCB1F448283236C890B5E@SHSMSX101.ccr.corp.intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Sun, Yanyan
Sent: Monday, August 6, 2018 10:17 AM
To: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>; Sun, Yanyan <yanyan.sun@intel.com>
Subject: RE: [Patch] BaseTools/BinToPcd: Open output file as text file
Mike:
Tried this patch, seems that the issue is fixed.
-----Original Message-----
From: Kinney, Michael D
Sent: Saturday, August 04, 2018 4:48 AM
To: edk2-devel@lists.01.org
Cc: Sun, Yanyan <yanyan.sun@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [Patch] BaseTools/BinToPcd: Open output file as text file
https://bugzilla.tianocore.org/show_bug.cgi?id=1069
Undo changes from following commit:
https://github.com/tianocore/edk2/commit/83964ebc5e74549d6efc7134af19150a0b2079aa
Change the open mode for the output file from 'wb' to 'w' so the output file is written as a text file and not a binary file.
This resolves the issue where the text file was not writable from Python 3.x and also removes b'' from output file when the string was encoded as a bytearray.
Cc: YanYan Sun <yanyan.sun@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
BaseTools/Scripts/BinToPcd.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py index 1495a36933..316cc6117f 100644
--- a/BaseTools/Scripts/BinToPcd.py
+++ b/BaseTools/Scripts/BinToPcd.py
@@ -70,8 +70,7 @@ if __name__ == '__main__':
#
# Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD length in bytes
#
- PcdValue = '{' + ', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer]) + '}'
- return PcdValue.encode (), len (Buffer)
+ return '{' + (', '.join (['0x{Byte:02X}'.format (Byte = Item)
+ for Item in Buffer])) + '}', len (Buffer)
#
# Create command line argument parser object @@ -81,7 +80,7 @@ if __name__ == '__main__':
conflict_handler = 'resolve')
parser.add_argument ("-i", "--input", dest = 'InputFile', type = argparse.FileType ('rb'), action='append', required = True,
help = "Input binary filename. Multiple input files are combined into a single PCD.")
- parser.add_argument ("-o", "--output", dest = 'OutputFile', type = argparse.FileType ('wb'),
+ parser.add_argument ("-o", "--output", dest = 'OutputFile', type =
+ argparse.FileType ('w'),
help = "Output filename for PCD value or PCD statement")
parser.add_argument ("-p", "--pcd", dest = 'PcdName', type = ValidatePcdName,
help = "Name of the PCD in the form <PcdTokenSpaceGuidCName>.<PcdCName>")
--
2.14.2.windows.3
prev parent reply other threads:[~2018-08-06 2:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 20:47 [Patch] BaseTools/BinToPcd: Open output file as text file Kinney, Michael D
[not found] ` <CB4A686B405FEF49A15CCB1F448283236C890B5E@SHSMSX101.ccr.corp.intel.com>
2018-08-06 2:29 ` Zhu, Yonghong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B9726D6DCCFB8B4CA276A9169B02216D520CD286@SHSMSX103.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox