projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'u-boot-rockchip-20200531' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git]
/
tools
/
dtoc
/
fdt.py
diff --git
a/tools/dtoc/fdt.py
b/tools/dtoc/fdt.py
index 6770be79fbe3a28fc6d6b8462769c06929e14de0..188490b728f890d05ab8b793fcdc894df4390ebb 100644
(file)
--- a/
tools/dtoc/fdt.py
+++ b/
tools/dtoc/fdt.py
@@
-8,10
+8,10
@@
import struct
import sys
import struct
import sys
-import fdt_util
+
from dtoc
import fdt_util
import libfdt
from libfdt import QUIET_NOTFOUND
import libfdt
from libfdt import QUIET_NOTFOUND
-import tools
+
from patman
import tools
# This deals with a device tree, presenting it as an assortment of Node and
# Prop objects, representing nodes and properties, respectively. This file
# This deals with a device tree, presenting it as an assortment of Node and
# Prop objects, representing nodes and properties, respectively. This file
@@
-56,9
+56,6
@@
def BytesToValue(data):
is_string = False
break
for ch in string:
is_string = False
break
for ch in string:
- # Handle Python 2 treating bytes as str
- if type(ch) == str:
- ch = ord(ch)
if ch < 32 or ch > 127:
is_string = False
break
if ch < 32 or ch > 127:
is_string = False
break
@@
-66,15
+63,9
@@
def BytesToValue(data):
is_string = False
if is_string:
if count == 1:
is_string = False
if is_string:
if count == 1:
- if sys.version_info[0] >= 3: # pragma: no cover
- return TYPE_STRING, strings[0].decode()
- else:
- return TYPE_STRING, strings[0]
+ return TYPE_STRING, strings[0].decode()
else:
else:
- if sys.version_info[0] >= 3: # pragma: no cover
- return TYPE_STRING, [s.decode() for s in strings[:-1]]
- else:
- return TYPE_STRING, strings[:-1]
+ return TYPE_STRING, [s.decode() for s in strings[:-1]]
if size % 4:
if size == 1:
return TYPE_BYTE, tools.ToChar(data[0])
if size % 4:
if size == 1:
return TYPE_BYTE, tools.ToChar(data[0])
@@
-415,8
+406,8
@@
class Node:
prop_name: Name of property to set
val: String value to set (will be \0-terminated in DT)
"""
prop_name: Name of property to set
val: String value to set (will be \0-terminated in DT)
"""
- if
sys.version_info[0] >= 3: # pragma: no cover
- val =
bytes(val,
'utf-8')
+ if
type(val) == str:
+ val =
val.encode(
'utf-8')
self._CheckProp(prop_name).props[prop_name].SetData(val + b'\0')
def AddString(self, prop_name, val):
self._CheckProp(prop_name).props[prop_name].SetData(val + b'\0')
def AddString(self, prop_name, val):