10000 tools/makemanifest.py: Update to use mpy_cross module. · micropython/micropython@dbab78a · GitHub
[go: up one dir, main page]

Skip to content

Commit dbab78a

Browse files
committed
tools/makemanifest.py: Update to use mpy_cross module.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
1 parent 9b8348c commit dbab78a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tools/makemanifest.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
import os
3030
import subprocess
3131

32+
sys.path.append(os.path.join(os.path.dirname(__file__), '../mpy-cross'))
33+
import mpy_cross
34+
3235
import manifestfile
3336

3437
VARS = {}
@@ -173,7 +176,7 @@ def main():
173176
str_paths = []
174177
mpy_files = []
175178
ts_newest = 0
176-
for full_path, target_path, timestamp, kind, version, opt in manifest.files():
179+
for _file_type, full_path, target_path, timestamp, kind, version, opt in manifest.files():
177180
if kind == manifestfile.KIND_FREEZE_AS_STR:
178181
str_paths.append((full_path, target_path,))
179182
ts_outfile = timestamp
@@ -183,14 +186,11 @@ def main():
183186
if timestamp >= ts_outfile:
184187
print("MPY", target_path)
185188
mkdir(outfile)
186-
res, out = system(
187-
[MPY_CROSS]
188-
+ args.mpy_cross_flags.split()
189-
+ ["-o", outfile, "-s", target_path, "-O{}".format(opt), full_path]
190-
)
191-
if res != 0:
192-
print("error compiling {}:".format(infile))
193-
sys.stdout.buffer.write(out)
189+
try:
190+
mpy_cross.compile(full_path, dest=outfile, src_path=target_path, mpy_cross=MPY_CROSS, extra_args=args.mpy_cross_flags.split())
191+
except mpy_cross.CrossCompileError as ex:
192+
print("error compiling {}:".format(target_path))
193+
print(ex.args[0])
194194
raise SystemExit(1)
195195
ts_outfile = get_timestamp(outfile)
196196
mpy_files.append(outfile)

0 commit comments

Comments
 (0)
0