diff mbox series

[01/10] dtoc: binman: Drop Python 2 code

Message ID 20210107043519.2634625-2-sjg@chromium.org
State Accepted
Commit 9fc6ebd8feb4654483b544d12587857cf8938796
Delegated to: Simon Glass
Headers show
Series binman: Various minor fixes and improvement | expand

Commit Message

Simon Glass Jan. 7, 2021, 4:35 a.m. UTC
Drop a few more Python 2 relics that are no-longer needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/fmap_util.py | 4 ++--
 tools/dtoc/fdt.py         | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

Comments

Simon Glass Jan. 23, 2021, 5:27 p.m. UTC | #1
Drop a few more Python 2 relics that are no-longer needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/fmap_util.py | 4 ++--
 tools/dtoc/fdt.py         | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/fmap_util.py b/tools/binman/fmap_util.py
index b03fc28fbb4..8277619768c 100644
--- a/tools/binman/fmap_util.py
+++ b/tools/binman/fmap_util.py
@@ -53,8 +53,8 @@  FmapArea = collections.namedtuple('FmapArea', FMAP_AREA_NAMES)
 
 
 def NameToFmap(name):
-    if type(name) == bytes and sys.version_info[0] >= 3:
-        name = name.decode('utf-8')  # pragma: no cover (for Python 2)
+    if type(name) == bytes:
+        name = name.decode('utf-8')
     return name.replace('\0', '').replace('-', '_').upper()
 
 def ConvertName(field_names, fields):
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 4a78c737252..965106a3b28 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -460,8 +460,7 @@  class Node:
             prop_name: Name of property to add
             val: String value of property
         """
-        if sys.version_info[0] >= 3:  # pragma: no cover
-            val = bytes(val, 'utf-8')
+        val = bytes(val, 'utf-8')
         self.AddData(prop_name, val + b'\0')
 
     def AddSubnode(self, name):