@@ -99,7 +99,7 @@ def set_config_from_tool_location(config_key, tool_binary, f):
99
99
if val is None :
100
100
path = shutil .which (tool_binary )
101
101
if not path :
102
- if not os .path .exists (EM_CONFIG ):
102
+ if not os .path .isfile (EM_CONFIG ):
103
103
diagnostics .warn ('config file not found: %s. You can create one by hand or run `emcc --generate-config`' , EM_CONFIG )
104
104
exit_with_error ('%s not set in config (%s), and `%s` not found in PATH' , config_key , EM_CONFIG , tool_binary )
105
105
globals ()[config_key ] = f (path )
@@ -155,11 +155,11 @@ def parse_config_file():
155
155
156
156
157
157
def read_config ():
158
- if os .path .exists (EM_CONFIG ):
158
+ if os .path .isfile (EM_CONFIG ):
159
159
parse_config_file ()
160
160
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.
163
163
LEGACY_ENV_VARS = {
164
164
'LLVM' : 'EM_LLVM_ROOT' ,
165
165
'BINARYEN' : 'EM_BINARYEN_ROOT' ,
@@ -172,7 +172,8 @@ def read_config():
172
172
env_value = os .environ .get (key )
173
173
if env_value and new_key not in os .environ :
174
174
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:
176
177
# See https://github.com/emscripten-core/emsdk/issues/862
177
178
if key == 'NODE' :
178
179
logger .debug (msg )
@@ -266,13 +267,13 @@ def find_config_file():
266
267
if 'EM_CONFIG' in os .environ :
267
268
return os .environ ['EM_CONFIG' ]
268
269
269
- if os .path .exists (embedded_config ):
270
+ if os .path .isfile (embedded_config ):
270
271
return embedded_config
271
272
272
- if os .path .exists (emsdk_embedded_config ):
273
+ if os .path .isfile (emsdk_embedded_config ):
273
274
return emsdk_embedded_config
274
275
275
- if os .path .exists (user_home_config ):
276
+ if os .path .isfile (user_home_config ):
276
277
return user_home_config
277
278
278
279
# No config file found. Return the default location.
@@ -292,13 +293,17 @@ def init():
292
293
293
294
EM_CONFIG = os .path .expanduser (EM_CONFIG )
294
295
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).
297
299
if '--generate-config' in sys .argv :
298
300
generate_config (EM_CONFIG )
299
301
sys .exit (0 )
300
302
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' )
302
307
303
308
# Emscripten compiler spawns other processes, which can reimport shared.py, so
304
309
# make sure that those child processes get the same configuration file by
0 commit comments