Skip to content

Commit a636837

Browse files
committed
tools/makemanifest.py: Support freezing with empty list of mpy files.
Fixes issue micropython#5655.
1 parent 410757f commit a636837

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

tools/makemanifest.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,22 @@ def main():
276276
sys.exit(1)
277277

278278
# Freeze .mpy files
279-
res, output_mpy = system([sys.executable, MPY_TOOL, '-f', '-q', args.build_dir + '/genhdr/qstrdefs.preprocessed.h'] + mpy_files)
280-
if res != 0:
281-
print('error freezing mpy {}: {}'.format(mpy_files, output_mpy))
282-
sys.exit(1)
279+
if mpy_files:
280+
res, output_mpy = system([sys.executable, MPY_TOOL, '-f', '-q', args.build_dir + '/genhdr/qstrdefs.preprocessed.h'] + mpy_files)
281+
if res != 0:
282+
print('error freezing mpy {}:'.format(mpy_files))
283+
print(str(output_mpy, 'utf8'))
284+
sys.exit(1)
285+
else:
286+
output_mpy = (
287+
b'#include "py/emitglue.h"\n'
288+
b'extern const qstr_pool_t mp_qstr_const_pool;\n'
289+
b'const qstr_pool_t mp_qstr_frozen_const_pool = {\n'
290+
b' (qstr_pool_t*)&mp_qstr_const_pool, MP_QSTRnumber_of, 0, 0\n'
291+
b'};\n'
292+
b'const char mp_frozen_mpy_names[1] = {"\\0"};\n'
293+
b'const mp_raw_code_t *const mp_frozen_mpy_content[0] = {};\n'
294+
)
283295

284296
# Generate output
285297
print('GEN', args.output)

0 commit comments

Comments
 (0)