MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_build_info

Function get_build_info

Lib/test/libregrtest/utils.py:298–401  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

296
297
298def get_build_info():
299 # Get most important configure and build options as a list of strings.
300 # Example: ['debug', 'ASAN+MSAN'] or ['release', 'LTO+PGO'].
301
302 config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
303 cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
304 cflags += ' ' + (sysconfig.get_config_var('PY_CFLAGS_NODIST') or '')
305 ldflags_nodist = sysconfig.get_config_var('PY_LDFLAGS_NODIST') or ''
306
307 build = []
308
309 # --disable-gil
310 if sysconfig.get_config_var('Py_GIL_DISABLED'):
311 if not sys.flags.ignore_environment:
312 PYTHON_GIL = os.environ.get('PYTHON_GIL', None)
313 if PYTHON_GIL:
314 PYTHON_GIL = (PYTHON_GIL == '1')
315 else:
316 PYTHON_GIL = None
317
318 free_threading = "free_threading"
319 if PYTHON_GIL is not None:
320 free_threading = f"{free_threading} GIL={int(PYTHON_GIL)}"
321 build.append(free_threading)
322
323 if hasattr(sys, 'gettotalrefcount'):
324 # --with-pydebug
325 build.append('debug')
326
327 if '-DNDEBUG' in cflags:
328 build.append('without_assert')
329 else:
330 build.append('release')
331
332 if '--with-assertions' in config_args:
333 build.append('with_assert')
334 elif '-DNDEBUG' not in cflags:
335 build.append('with_assert')
336
337 # --enable-experimental-jit
338 if sys._jit.is_available():
339 if sys._jit.is_enabled():
340 build.append("JIT")
341 else:
342 build.append("JIT (disabled)")
343
344 # --enable-framework=name
345 framework = sysconfig.get_config_var('PYTHONFRAMEWORK')
346 if framework:
347 build.append(f'framework={framework}')
348
349 # --enable-shared
350 shared = int(sysconfig.get_config_var('PY_ENABLE_SHARED') or '0')
351 if shared:
352 build.append('shared')
353
354 # --with-lto
355 optimizations = []

Callers 1

display_headerFunction · 0.70

Calls 5

hasattrFunction · 0.85
is_enabledMethod · 0.80
getMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected