diff mbox series

[2/4] package/optee-test: use python3 instead of python

Message ID 20200308183535.1206604-2-romain.naour@smile.fr
State Accepted
Headers show
Series None | expand

Commit Message

Romain Naour March 8, 2020, 6:35 p.m. UTC
Fixes:
TypeError: cannot use a str to initialize an array with typecode 'B'
  File "../../scripts/file_to_c.py", line 32, in main
    for x in array.array("B", inf.read()):
    for x in array.array("B", inf.read()):
TypeError: cannot use a str to initialize an array with typecode 'B'
TypeError: cannot use a str to initialize an array with typecode 'B'

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 .../0001-use-python3-instead-of-python.patch  | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 package/optee-test/0001-use-python3-instead-of-python.patch

Comments

Peter Korsgaard March 8, 2020, 8:06 p.m. UTC | #1
>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > Fixes:
 > TypeError: cannot use a str to initialize an array with typecode 'B'
 >   File "../../scripts/file_to_c.py", line 32, in main
 >     for x in array.array("B", inf.read()):
 >     for x in array.array("B", inf.read()):
 > TypeError: cannot use a str to initialize an array with typecode 'B'
 > TypeError: cannot use a str to initialize an array with typecode 'B'

 > Signed-off-by: Romain Naour <romain.naour@smile.fr>

Reworded the commit message a bit and committed, thanks.
Peter Korsgaard March 15, 2020, 11 a.m. UTC | #2
>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > Fixes:
 > TypeError: cannot use a str to initialize an array with typecode 'B'
 >   File "../../scripts/file_to_c.py", line 32, in main
 >     for x in array.array("B", inf.read()):
 >     for x in array.array("B", inf.read()):
 > TypeError: cannot use a str to initialize an array with typecode 'B'
 > TypeError: cannot use a str to initialize an array with typecode 'B'

 > Signed-off-by: Romain Naour <romain.naour@smile.fr>

Committed to 2019.11.x, thanks.
diff mbox series

Patch

diff --git a/package/optee-test/0001-use-python3-instead-of-python.patch b/package/optee-test/0001-use-python3-instead-of-python.patch
new file mode 100644
index 0000000000..2765a980db
--- /dev/null
+++ b/package/optee-test/0001-use-python3-instead-of-python.patch
@@ -0,0 +1,50 @@ 
+From cc3cb798375c5f47ea5c7579f32060933435e231 Mon Sep 17 00:00:00 2001
+From: Scott Branden <scott.branden@broadcom.com>
+Date: Fri, 27 Dec 2019 12:54:28 -0800
+Subject: [PATCH] use python3 instead of python
+
+use python3 instead of python as python2 is EOL January 2020.
+
+Signed-off-by: Scott Branden <scott.branden@broadcom.com>
+Reviewed-by: Jerome Forissier <jerome@forissier.org>
+Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, CFG_GCM_NIST_VECTORS=y)
+
+(cherry picked from commit 6271160639002a2580d80b75b5397a96d56329f2)
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+ scripts/file_to_c.py       | 4 ++--
+ scripts/rsp_to_gcm_test.py | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/scripts/file_to_c.py b/scripts/file_to_c.py
+index ae16f52..b4ce2a2 100755
+--- a/scripts/file_to_c.py
++++ b/scripts/file_to_c.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # SPDX-License-Identifier: BSD-2-Clause
+ #
+ # Copyright (c) 2018, Linaro Limited
+@@ -29,7 +29,7 @@ def main():
+ 
+     f.write("const uint8_t " + args.name + "[] = {\n")
+     i = 0
+-    for x in array.array("B", inf.read()):
++    for x in array.array("B", map(ord, (inf.read()))):
+         f.write("0x" + '{0:02x}'.format(x) + ",")
+         i = i + 1
+         if i % 8 == 0:
+diff --git a/scripts/rsp_to_gcm_test.py b/scripts/rsp_to_gcm_test.py
+index 0543541..e4418be 100755
+--- a/scripts/rsp_to_gcm_test.py
++++ b/scripts/rsp_to_gcm_test.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ 
+ modes = {'encrypt': 0, 'decrypt': 1}
+ 
+-- 
+2.24.1
+