Skip to content

Commit de575c8

Browse files
committed
tools/make-frozen.py: Actually make Python2-compatible.
1 parent 3a2e9f2 commit de575c8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tools/make-frozen.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# Create frozen modules structure for MicroPython.
44
#
@@ -49,7 +49,11 @@ def module_name(f):
4949
m = module_name(f)
5050
print('"%s\\0"' % m)
5151
data = open(sys.argv[1] + "/" + f, "rb").read()
52-
data = repr(data)[2:-1]
52+
# Python2 vs Python3 tricks
53+
data = repr(data)
54+
if data[0] == "b":
55+
data = data[1:]
56+
data = data[1:-1]
5357
data = data.replace('"', '\\"')
5458
print('"%s"' % data)
5559
print("};")

0 commit comments

Comments
 (0)