* [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray()
@ 2018-08-02 21:25 Kinney, Michael D
2018-08-02 23:59 ` Zhu, Yonghong
0 siblings, 1 reply; 2+ messages in thread
From: Kinney, Michael D @ 2018-08-02 21:25 UTC (permalink / raw)
To: edk2-devel; +Cc: YanYan Sun, Yonghong Zhu, Liming Gao, Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=1069
The ByteArray() method returns a string with the hex bytes of
a PCD value. Make sure the string is always encoded as a string,
so it can be used to build a complete PCD statement string and be
written out to a file. This change is required for Python 3.x
compatibility.
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py
index 25b74f6004..1495a36933 100644
--- a/BaseTools/Scripts/BinToPcd.py
+++ b/BaseTools/Scripts/BinToPcd.py
@@ -70,7 +70,8 @@ if __name__ == '__main__':
#
# Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD length in bytes
#
- return '{' + (', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer])) + '}', len (Buffer)
+ PcdValue = '{' + ', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer]) + '}'
+ return PcdValue.encode (), len (Buffer)
#
# Create command line argument parser object
--
2.14.2.windows.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray()
2018-08-02 21:25 [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray() Kinney, Michael D
@ 2018-08-02 23:59 ` Zhu, Yonghong
0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-08-02 23:59 UTC (permalink / raw)
To: Kinney, Michael D, edk2-devel@lists.01.org
Cc: Sun, Yanyan, Gao, Liming, Zhu, Yonghong
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Kinney, Michael D
Sent: Friday, August 3, 2018 5:26 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: Encode string returned from ByteArray()
https://bugzilla.tianocore.org/show_bug.cgi?id=1069
The ByteArray() method returns a string with the hex bytes of a PCD value. Make sure the string is always encoded as a string, so it can be used to build a complete PCD statement string and be written out to a file. This change is required for Python 3.x compatibility.
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py index 25b74f6004..1495a36933 100644
--- a/BaseTools/Scripts/BinToPcd.py
+++ b/BaseTools/Scripts/BinToPcd.py
@@ -70,7 +70,8 @@ if __name__ == '__main__':
#
# Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD length in bytes
#
- return '{' + (', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer])) + '}', len (Buffer)
+ PcdValue = '{' + ', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer]) + '}'
+ return PcdValue.encode (), len (Buffer)
#
# Create command line argument parser object
--
2.14.2.windows.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-02 23:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-02 21:25 [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray() Kinney, Michael D
2018-08-02 23:59 ` Zhu, Yonghong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox