83
83
__rootdir__ = os .path .dirname (__scriptdir__ )
84
84
sys .path .insert (0 , __rootdir__ )
85
85
86
- from tools import shared , utils , js_manipulation
86
+ from tools import shared , utils , js_manipulation , diagnostics
87
87
from tools .response_file import substitute_response_files
88
88
89
89
@@ -398,7 +398,7 @@ def main(): # noqa: C901, PLR0912, PLR0915
398
398
options .indexeddb_name = arg .split ('=' , 1 )[1 ] if '=' in arg else None
399
399
leading = ''
400
400
elif arg == '--no-heap-copy' :
401
- err ('ignoring legacy flag --no-heap-copy (that is the only mode supported now)' )
401
+ diagnostics . warn ('ignoring legacy flag --no-heap-copy (that is the only mode supported now)' )
402
402
leading = ''
403
403
elif arg == '--separate-metadata' :
404
404
options .separate_metadata = True
@@ -455,12 +455,12 @@ def main(): # noqa: C901, PLR0912, PLR0915
455
455
data_files .append (DataFile (srcpath = srcpath , dstpath = dstpath , mode = mode ,
456
456
explicit_dst_path = uses_at_notation ))
457
457
else :
458
- err ( 'error: ' + arg + ' does not exist' )
458
+ diagnostics . error ( f'$ { arg } does not exist' )
459
459
return 1
460
460
elif leading == 'exclude' :
461
461
excluded_patterns .append (arg )
462
462
else :
463
- err ('Unknown parameter:' , arg )
463
+ diagnostics . error ('Unknown parameter:' , arg )
464
464
return 1
465
465
466
466
options .has_preloaded = any (f .mode == 'preload' for f in data_files )
@@ -473,11 +473,11 @@ def main(): # noqa: C901, PLR0912, PLR0915
473
473
return 1
474
474
475
475
if not options .from_emcc and not options .quiet :
476
- err ('Remember to build the main file with `-sFORCE_FILESYSTEM` '
476
+ diagnostics . warn ('Remember to build the main file with `-sFORCE_FILESYSTEM` '
477
477
'so that it includes support for loading this file package' )
478
478
479
479
if options .jsoutput and os .path .abspath (options .jsoutput ) == os .path .abspath (data_target ):
480
- err ( 'error: TARGET should not be the same value of --js-output' )
480
+ diagnostics . error ( ' TARGET should not be the same value of --js-output' )
481
481
return 1
482
482
483
483
walked .append (__file__ )
@@ -491,7 +491,7 @@ def main(): # noqa: C901, PLR0912, PLR0915
491
491
data_files = [file_ for file_ in new_data_files
492
492
if not os .path .isdir (file_ .srcpath )]
493
493
if len (data_files ) == 0 :
494
- err ('Nothing to do!' )
494
+ diagnostics . error ('Nothing to do!' )
495
495
sys .exit (1 )
496
496
497
497
# Absolutize paths, and check that they make sense
@@ -519,7 +519,7 @@ def main(): # noqa: C901, PLR0912, PLR0915
519
519
sys .exit (1 )
520
520
file_ .dstpath = abspath [len (curr_abspath ) + 1 :]
521
521
if os .path .isabs (path ):
522
- err ( 'Warning: Embedding an absolute file/directory name "%s" to the '
522
+ diagnostics . warn ( ' Embedding an absolute file/directory name "%s" to the '
523
523
'virtual filesystem. The file will be made available in the '
524
524
'relative path "%s". You can use the `--preload-file srcpath@dstpath` '
525
525
'syntax to explicitly specify the target location the absolute source '
@@ -564,7 +564,7 @@ def was_seen(name):
564
564
565
565
if options .obj_output :
566
566
if not options .has_embedded :
567
- err ('--obj-output is only applicable when embedding files' )
567
+ diagnostics . error ('--obj-output is only applicable when embedding files' )
568
568
return 1
569
569
generate_object_file (data_files )
570
570
if not options .has_preloaded :
@@ -666,7 +666,7 @@ def generate_js(data_target, data_files, metadata):
666
666
data .write (curr )
667
667
668
668
if start > 256 * 1024 * 1024 :
669
- err ( 'warning: file packager is creating an asset bundle of %d MB. '
669
+ diagnostics . warn ( ' file packager is creating an asset bundle of %d MB. '
670
670
'this is very large, and browsers might have trouble loading it. '
671
671
'see https://hacks.mozilla.org/2015/02/synchronous-execution-and-filesystem-access-in-emscripten/'
672
672
% (start / (1024 * 1024 )))
@@ -715,7 +715,7 @@ def generate_js(data_target, data_files, metadata):
715
715
}\n ''' % (create_preloaded if options .use_preload_plugins else create_data )
716
716
717
717
if options .has_embedded and not options .obj_output :
718
- err ('--obj-output is recommended when using --embed. This outputs an object file for linking directly into your application is more efficient than JS encoding' )
718
+ diagnostics . warn ('--obj-output is recommended when using --embed. This outputs an object file for linking directly into your application is more efficient than JS encoding' )
719
719
720
720
for counter , file_ in enumerate (data_files ):
721
721
filename = file_ .dstpath
0 commit comments