56
56
# Enable this to do very verbose printing about the different steps that are
57
57
# being run. Useful for debugging.
58
58
VERBOSE = int (os .getenv ('EMSDK_VERBOSE' , '0' ))
59
+ QUIET = int (os .getenv ('EMSDK_QUIET' , '0' ))
59
60
TTY_OUTPUT = not os .getenv ('EMSDK_NOTTY' , not sys .stdout .isatty ())
60
61
61
62
63
+ def info (msg ):
64
+ if not QUIET :
65
+ print (msg , file = sys .stderr )
66
+
67
+
62
68
def errlog (msg ):
63
69
print (msg , file = sys .stderr )
64
70
@@ -2663,10 +2669,10 @@ def get_env_vars_to_add(tools_to_activate, system, user):
2663
2669
env_vars_to_add += [('PATH' , newpath )]
2664
2670
2665
2671
if added_path :
2666
- errlog ('Adding directories to PATH:' )
2672
+ info ('Adding directories to PATH:' )
2667
2673
for item in added_path :
2668
- errlog ('PATH += ' + item )
2669
- errlog ('' )
2674
+ info ('PATH += ' + item )
2675
+ info ('' )
2670
2676
2671
2677
# A core variable EMSDK points to the root of Emscripten SDK directory.
2672
2678
env_vars_to_add += [('EMSDK' , to_unix_path (emsdk_path ()))]
@@ -2705,6 +2711,7 @@ def get_env_vars_to_add(tools_to_activate, system, user):
2705
2711
2706
2712
2707
2713
def construct_env (tools_to_activate , system , user ):
2714
+ info ('Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)' )
2708
2715
return construct_env_with_vars (get_env_vars_to_add (tools_to_activate , system , user ))
2709
2716
2710
2717
@@ -2723,13 +2730,13 @@ def unset_env(key):
2723
2730
def construct_env_with_vars (env_vars_to_add ):
2724
2731
env_string = ''
2725
2732
if env_vars_to_add :
2726
- errlog ('Setting environment variables:' )
2733
+ info ('Setting environment variables:' )
2727
2734
2728
2735
for key , value in env_vars_to_add :
2729
2736
# Don't set env vars which are already set to the correct value.
2730
2737
if key in os .environ and to_unix_path (os .environ [key ]) == to_unix_path (value ):
2731
2738
continue
2732
- errlog (key + ' = ' + value )
2739
+ info (key + ' = ' + value )
2733
2740
if POWERSHELL :
2734
2741
env_string += '$env:' + key + '="' + value + '"\n '
2735
2742
elif CMD :
@@ -2757,9 +2764,9 @@ def construct_env_with_vars(env_vars_to_add):
2757
2764
'EMSDK_NUM_CORES' , 'EMSDK_NOTTY' , 'EMSDK_KEEP_DOWNLOADS' ])
2758
2765
env_keys_to_add = set (pair [0 ] for pair in env_vars_to_add )
2759
2766
for key in os .environ :
2760
- if key .startswith ('EMSDK_' ) or key .startswith ('EM_ ' ):
2767
+ if key .startswith ('EMSDK_' ) or key .startswith ('EM_CACHE ' ):
2761
2768
if key not in env_keys_to_add and key not in ignore_keys :
2762
- errlog ('Clearing existing environment variable: %s' % key )
2769
+ info ('Clearing existing environment variable: %s' % key )
2763
2770
env_string += unset_env (key )
2764
2771
2765
2772
return env_string
0 commit comments