BaseTools/BinToPcd: Fix Python 2.7.x compatibility issue
authorKinney, Michael D <michael.d.kinney@intel.com>
Tue, 31 Jul 2018 16:24:20 +0000 (09:24 -0700)
committerKinney, Michael D <michael.d.kinney@intel.com>
Wed, 1 Aug 2018 22:27:56 +0000 (15:27 -0700)
https://bugzilla.tianocore.org/show_bug.cgi?id=1042

Convert Buffer to type bytearray before converting to a
string of hex byte values so the type of items in Buffer is
consistent for both Python 2.7.x and Python 3.x.

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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Scripts/BinToPcd.py

index c42e37b..25b74f6 100644 (file)
@@ -66,7 +66,7 @@ if __name__ == '__main__':
             #\r
             # If Xdr flag is not set, then concatenate all the data\r
             #\r
             #\r
             # If Xdr flag is not set, then concatenate all the data\r
             #\r
-            Buffer = b''.join (Buffer)\r
+            Buffer = bytearray (b''.join (Buffer))\r
         #\r
         # Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD length in bytes\r
         #\r
         #\r
         # Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD length in bytes\r
         #\r