tools/makemanifest.py: Update to use mpy_cross module.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/8914/head
Jim Mussared 2022-07-15 23:06:15 +10:00
rodzic e42809531f
commit 6bd0ec7a70
1 zmienionych plików z 16 dodań i 9 usunięć

Wyświetl plik

@ -29,6 +29,9 @@ import sys
import os import os
import subprocess import subprocess
sys.path.append(os.path.join(os.path.dirname(__file__), "../mpy-cross"))
import mpy_cross
import manifestfile import manifestfile
VARS = {} VARS = {}
@ -173,7 +176,7 @@ def main():
str_paths = [] str_paths = []
mpy_files = [] mpy_files = []
ts_newest = 0 ts_newest = 0
for full_path, target_path, timestamp, kind, version, opt in manifest.files(): for _file_type, full_path, target_path, timestamp, kind, version, opt in manifest.files():
if kind == manifestfile.KIND_FREEZE_AS_STR: if kind == manifestfile.KIND_FREEZE_AS_STR:
str_paths.append( str_paths.append(
( (
@ -188,14 +191,18 @@ def main():
if timestamp >= ts_outfile: if timestamp >= ts_outfile:
print("MPY", target_path) print("MPY", target_path)
mkdir(outfile) mkdir(outfile)
res, out = system( try:
[MPY_CROSS] mpy_cross.compile(
+ args.mpy_cross_flags.split() full_path,
+ ["-o", outfile, "-s", target_path, "-O{}".format(opt), full_path] dest=outfile,
) src_path=target_path,
if res != 0: opt=opt,
print("error compiling {}:".format(infile)) mpy_cross=MPY_CROSS,
sys.stdout.buffer.write(out) extra_args=args.mpy_cross_flags.split(),
)
except mpy_cross.CrossCompileError as ex:
print("error compiling {}:".format(target_path))
print(ex.args[0])
raise SystemExit(1) raise SystemExit(1)
ts_outfile = get_timestamp(outfile) ts_outfile = get_timestamp(outfile)
mpy_files.append(outfile) mpy_files.append(outfile)