MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / main

Function main

tools/file_packager.py:351–610  ·  view source on GitHub ↗

Future modifications should consider refactoring to reduce complexity. * The McCabe cyclomatiic complexity is currently 60 vs 10 recommended. * There are currently 63 branches vs 12 recommended. * There are currently 151 statements vs 50 recommended. To revalidate these numbers, run `ruff

()

Source from the content-addressed store, hash-verified

349
350
351def main(): # noqa: C901, PLR0912, PLR0915
352 """Future modifications should consider refactoring to reduce complexity.
353
354 * The McCabe cyclomatiic complexity is currently 60 vs 10 recommended.
355 * There are currently 63 branches vs 12 recommended.
356 * There are currently 151 statements vs 50 recommended.
357
358 To revalidate these numbers, run `ruff check --select=C901,PLR091`.
359 """
360 if len(sys.argv) == 1:
361 err('''Usage: file_packager TARGET [--preload A [B..]] [--embed C [D..]] [--exclude E [F..]] [--js-output=OUTPUT.js] [--no-force] [--use-preload-cache] [--indexedDB-name=EM_PRELOAD_CACHE] [--separate-metadata] [--lz4] [--use-preload-plugins] [--no-node] [--export-es6] [--help]
362 Try 'file_packager --help' for more details.''')
363 return 1
364
365 # read response files very early on
366 try:
367 args = substitute_response_files(sys.argv[1:])
368 except OSError as e:
369 utils.exit_with_error(e)
370
371 if '--help' in args:
372 print(__doc__.strip())
373 return 0
374
375 data_target = args[0]
376 data_files = []
377 leading = ''
378
379 for arg in args[1:]:
380 if arg == '--preload':
381 leading = 'preload'
382 elif arg == '--embed':
383 leading = 'embed'
384 elif arg == '--exclude':
385 leading = 'exclude'
386 elif arg == '--no-force':
387 options.force = False
388 leading = ''
389 elif arg == '--export-es6':
390 options.export_es6 = True
391 leading = ''
392 elif arg == '--use-preload-cache':
393 options.use_preload_cache = True
394 leading = ''
395 elif arg.startswith('--indexedDB-name'):
396 options.indexeddb_name = arg.split('=', 1)[1] if '=' in arg else None
397 leading = ''
398 elif arg == '--no-heap-copy':
399 diagnostics.warn('ignoring legacy flag --no-heap-copy (that is the only mode supported now)')
400 leading = ''
401 elif arg == '--separate-metadata':
402 options.separate_metadata = True
403 leading = ''
404 elif arg == '--lz4':
405 options.lz4 = True
406 leading = ''
407 elif arg == '--use-preload-plugins':
408 options.use_preload_plugins = True

Callers 1

file_packager.pyFile · 0.70

Calls 15

should_ignoreFunction · 0.85
was_seenFunction · 0.85
generate_object_fileFunction · 0.85
construct_data_file_nameFunction · 0.85
generate_preload_jsFunction · 0.85
escape_for_makefileFunction · 0.85
splitMethod · 0.80
appendMethod · 0.80
write_fileMethod · 0.80
errFunction · 0.70
printFunction · 0.70

Tested by

no test coverage detected