summaryrefslogtreecommitdiff
path: root/tools/make-frozen.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/make-frozen.py')
-rwxr-xr-xtools/make-frozen.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/make-frozen.py b/tools/make-frozen.py
index ad23b9d59..f9ffa7642 100755
--- a/tools/make-frozen.py
+++ b/tools/make-frozen.py
@@ -30,6 +30,7 @@ import os
def module_name(f):
return f
+
modules = []
root = sys.argv[1].rstrip("/")
@@ -39,7 +40,7 @@ for dirpath, dirnames, filenames in os.walk(root):
for f in filenames:
fullpath = dirpath + "/" + f
st = os.stat(fullpath)
- modules.append((fullpath[root_len + 1:], st))
+ modules.append((fullpath[root_len + 1 :], st))
print("#include <stdint.h>")
print("const char mp_frozen_str_names[] = {")
@@ -66,8 +67,8 @@ for f, st in modules:
# data. We could just encode all characters as hex digits but it's nice
# to be able to read the resulting C code as ASCII when possible.
- data = bytearray(data) # so Python2 extracts each byte as an integer
- esc_dict = {ord('\n'): '\\n', ord('\r'): '\\r', ord('"'): '\\"', ord('\\'): '\\\\'}
+ data = bytearray(data) # so Python2 extracts each byte as an integer
+ esc_dict = {ord("\n"): "\\n", ord("\r"): "\\r", ord('"'): '\\"', ord("\\"): "\\\\"}
chrs = ['"']
break_str = False
for c in data:
@@ -80,9 +81,9 @@ for f, st in modules:
break_str = False
chrs.append(chr(c))
else:
- chrs.append('\\x%02x' % c)
+ chrs.append("\\x%02x" % c)
break_str = True
chrs.append('\\0"')
- print(''.join(chrs))
+ print("".join(chrs))
print("};")