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

Function init

tools/config.py:264–291  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

262
263
264def init():
265 global EM_CONFIG
266 EM_CONFIG = find_config_file()
267
268 # We used to support inline EM_CONFIG.
269 if '\n' in EM_CONFIG:
270 exit_with_error('inline EM_CONFIG data no longer supported. Please use a config file.')
271
272 EM_CONFIG = os.path.expanduser(EM_CONFIG)
273
274 # This command line flag needs to work even in the absence of a config
275 # file, so we must process it here at script import time (otherwise
276 # the error below will trigger).
277 if '--generate-config' in sys.argv:
278 generate_config(EM_CONFIG)
279 sys.exit(0)
280
281 if os.path.isfile(EM_CONFIG):
282 logger.debug(f'using config file: {EM_CONFIG}')
283 else:
284 logger.debug('config file not found; using default config')
285
286 # Emscripten compiler spawns other processes, which can reimport shared.py, so
287 # make sure that those child processes get the same configuration file by
288 # setting it to the currently active environment.
289 os.environ['EM_CONFIG'] = EM_CONFIG
290
291 read_config()
292
293
294init()

Callers 1

config.pyFile · 0.70

Calls 4

find_config_fileFunction · 0.85
exit_with_errorFunction · 0.85
generate_configFunction · 0.85
read_configFunction · 0.85

Tested by

no test coverage detected