]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/BinToPcd: Encode string returned from ByteArray()
authorKinney, Michael D <michael.d.kinney@intel.com>
Thu, 2 Aug 2018 21:22:23 +0000 (14:22 -0700)
committerKinney, Michael D <michael.d.kinney@intel.com>
Fri, 3 Aug 2018 01:42:27 +0000 (18:42 -0700)
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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Scripts/BinToPcd.py

index 25b74f60049335d57f0878ed69e40fe0c6f0c5d9..1495a36933c4ce5516aeb6bd48f4e8465da20fc3 100644 (file)
@@ -70,7 +70,8 @@ if __name__ == '__main__':
         #\r
         # Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD length in bytes\r
         #\r
-        return '{' + (', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer])) + '}', len (Buffer)\r
+        PcdValue = '{' + ', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer]) + '}'\r
+        return PcdValue.encode (), len (Buffer)\r
 \r
     #\r
     # Create command line argument parser object\r