@@ -99,7 +99,7 @@ def set_config_from_tool_location(config_key, tool_binary, f):
9999 if val is None :
100100 path = shutil .which (tool_binary )
101101 if not path :
102- if not os .path .exists (EM_CONFIG ):
102+ if not os .path .isfile (EM_CONFIG ):
103103 diagnostics .warn ('config file not found: %s. You can create one by hand or run `emcc --generate-config`' , EM_CONFIG )
104104 exit_with_error ('%s not set in config (%s), and `%s` not found in PATH' , config_key , EM_CONFIG , tool_binary )
105105 globals ()[config_key ] = f (path )
@@ -155,11 +155,11 @@ def parse_config_file():
155155
156156
157157def read_config ():
158- if os .path .exists (EM_CONFIG ):
158+ if os .path .isfile (EM_CONFIG ):
159159 parse_config_file ()
160160
161- # In the past the default-generated .emscripten config file would read certain environment
162- # variables.
161+ # In the past the default-generated .emscripten config file would read
162+ # certain environment variables.
163163 LEGACY_ENV_VARS = {
164164 'LLVM' : 'EM_LLVM_ROOT' ,
165165 'BINARYEN' : 'EM_BINARYEN_ROOT' ,
@@ -172,7 +172,8 @@ def read_config():
172172 env_value = os .environ .get (key )
173173 if env_value and new_key not in os .environ :
174174 msg = f'legacy environment variable found: `{ key } `. Please switch to using `{ new_key } ` instead`'
175- # Use `debug` instead of `warning` for `NODE` specifically since there can be false positives:
175+ # Use `debug` instead of `warning` for `NODE` specifically
176+ # since there can be false positives:
176177 # See https://github.com/emscripten-core/emsdk/issues/862
177178 if key == 'NODE' :
178179 logger .debug (msg )
@@ -266,13 +267,13 @@ def find_config_file():
266267 if 'EM_CONFIG' in os .environ :
267268 return os .environ ['EM_CONFIG' ]
268269
269- if os .path .exists (embedded_config ):
270+ if os .path .isfile (embedded_config ):
270271 return embedded_config
271272
272- if os .path .exists (emsdk_embedded_config ):
273+ if os .path .isfile (emsdk_embedded_config ):
273274 return emsdk_embedded_config
274275
275- if os .path .exists (user_home_config ):
276+ if os .path .isfile (user_home_config ):
276277 return user_home_config
277278
278279 # No config file found. Return the default location.
@@ -292,13 +293,17 @@ def init():
292293
293294 EM_CONFIG = os .path .expanduser (EM_CONFIG )
294295
295- # This command line flag needs to work even in the absence of a config file, so we must process it
296- # here at script import time (otherwise the error below will trigger).
296+ # This command line flag needs to work even in the absence of a config
297+ # file, so we must process it here at script import time (otherwise
298+ # the error below will trigger).
297299 if '--generate-config' in sys .argv :
298300 generate_config (EM_CONFIG )
299301 sys .exit (0 )
300302
301- logger .debug ('emscripten config is located in ' + EM_CONFIG )
303+ if os .path .isfile (EM_CONFIG ):
304+ logger .debug (f'using config file: ${ EM_CONFIG } ' )
305+ else :
306+ logger .debug ('config file not found; using default config' )
302307
303308 # Emscripten compiler spawns other processes, which can reimport shared.py, so
304309 # make sure that those child processes get the same configuration file by
0 commit comments