summaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-10-17 08:10:23 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-17 08:10:23 +0200
commitee6d4a74eb6efa643e7b834b32e04d01c6b29b7f (patch)
tree2ca84274dfe2e54729bca7dc4bbfe42611a1ee7f /Documentation
parentc59d7ab7317014cc14a98c47e91c2b582d5d08a7 (diff)
parent099b135ac30013dfc4b3310a5177cf2f7a17f3c3 (diff)
downloadbarebox-ee6d4a74eb6efa643e7b834b32e04d01c6b29b7f.tar.gz
Merge branch 'for-next/misc'
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/boards/stm32mp.rst4
-rwxr-xr-xDocumentation/gen_commands.py30
2 files changed, 22 insertions, 12 deletions
diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index 24cf885..774ede6 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -60,6 +60,10 @@ An appropriate image for the boot media can be generated with following
image = "barebox-@STM32MP_BOARD@.img"
size = 1M
}
+ partition barebox-environment {
+ image = "/dev/null"
+ size = 1M
+ }
}
Image can then be flashed on e.g. a SD-Card.
diff --git a/Documentation/gen_commands.py b/Documentation/gen_commands.py
index 6251b4f..203a39b 100755
--- a/Documentation/gen_commands.py
+++ b/Documentation/gen_commands.py
@@ -1,5 +1,7 @@
#!/usr/bin/python
+from __future__ import print_function
+
import errno
import os
import re
@@ -28,10 +30,15 @@ CONT = re.compile(r"""\s*"(.*?)"\s*\)?\s*$""")
CMDS = {}
+def string_escape(s):
+ # This used to do s.decode("string_escape") which isn't available on Python 3.
+ # Actually we only need to drop '\t' and '\n', so do this here.
+ return s.replace(r'\t', '').replace(r'\n', '')
+
def parse_c(name):
cmd = None
last = None
- for line in file(name, 'r'):
+ for line in open(name, 'r'):
x = HELP_START.match(line)
if x:
cmd = CMDS.setdefault(x.group(1), defaultdict(list))
@@ -50,14 +57,14 @@ def parse_c(name):
last = cmd['h_pre']
else:
last = cmd['h_post']
- last.append(x.group(1).decode("string_escape").strip())
+ last.append(string_escape(x.group(1)).strip())
continue
x = HELP_OPT.match(line)
if x:
last = cmd['h_opts']
last.append([
- x.group(1).decode("string_escape"),
- x.group(2).decode("string_escape")
+ string_escape(x.group(1)),
+ string_escape(x.group(2)),
])
continue
x = CMD_FUNC.match(line)
@@ -68,12 +75,12 @@ def parse_c(name):
x = CMD_DESC.match(line)
if x:
last = cmd['c_desc']
- last.append(x.group(1).decode("string_escape"))
+ last.append(string_escape(x.group(1)))
continue
x = CMD_OPTS.match(line)
if x:
last = cmd['c_opts']
- last.append(x.group(1).decode("string_escape"))
+ last.append(string_escape(x.group(1)))
continue
x = CMD_GROUP.match(line)
if x:
@@ -85,9 +92,9 @@ def parse_c(name):
if last is None:
raise Exception("Parse error in %s: %r" % (name, line))
if isinstance(last[-1], str):
- last[-1] += x.group(1).decode("string_escape")
+ last[-1] += string_escape(x.group(1))
elif isinstance(last[-1], list):
- last[-1][1] += x.group(1).decode("string_escape")
+ last[-1][1] += string_escape(x.group(1))
continue
x = HELP_END.match(line)
if x:
@@ -163,7 +170,7 @@ for name, cmd in CMDS.items():
rst = gen_rst(name, cmd)
group = cmd.get('c_group')
if group is None:
- print >> sys.stderr, "gen_commands: warning: using default group 'misc' for command '%s'" % name
+ print("gen_commands: warning: using default group 'misc' for command '%s'" % name, file=sys.stderr)
group = ['misc']
subdir = os.path.join(sys.argv[2], group[0])
try:
@@ -183,9 +190,8 @@ for name, cmd in CMDS.items():
except:
pass
hash_new = hashlib.sha1()
- hash_new.update(rst)
+ hash_new.update(rst.encode('utf-8'))
if hash_old.hexdigest() == hash_new.hexdigest():
continue
- file(target, 'w').write(rst)
-
+ open(target, 'w').write(rst)