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

Function _init_config_vars

Lib/sysconfig/__init__.py:509–591  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

507
508
509def _init_config_vars():
510 global _CONFIG_VARS
511 _CONFIG_VARS = {}
512
513 prefix = os.path.normpath(sys.prefix)
514 exec_prefix = os.path.normpath(sys.exec_prefix)
515 base_prefix = _BASE_PREFIX
516 base_exec_prefix = _BASE_EXEC_PREFIX
517
518 try:
519 abiflags = sys.abiflags
520 except AttributeError:
521 abiflags = ''
522
523 if os.name == 'posix':
524 _init_posix(_CONFIG_VARS)
525 # If we are cross-compiling, load the prefixes from the Makefile instead.
526 if '_PYTHON_PROJECT_BASE' in os.environ:
527 prefix = _CONFIG_VARS['host_prefix']
528 exec_prefix = _CONFIG_VARS['host_exec_prefix']
529 base_prefix = _CONFIG_VARS['host_prefix']
530 base_exec_prefix = _CONFIG_VARS['host_exec_prefix']
531 abiflags = _CONFIG_VARS['ABIFLAGS']
532
533 # Normalized versions of prefix and exec_prefix are handy to have;
534 # in fact, these are the standard versions used most places in the
535 # Distutils.
536 _CONFIG_VARS['prefix'] = prefix
537 _CONFIG_VARS['exec_prefix'] = exec_prefix
538 _CONFIG_VARS['py_version'] = _PY_VERSION
539 _CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT
540 _CONFIG_VARS['py_version_nodot'] = _PY_VERSION_SHORT_NO_DOT
541 _CONFIG_VARS['installed_base'] = base_prefix
542 _CONFIG_VARS['base'] = prefix
543 _CONFIG_VARS['installed_platbase'] = base_exec_prefix
544 _CONFIG_VARS['platbase'] = exec_prefix
545 _CONFIG_VARS['projectbase'] = _PROJECT_BASE
546 _CONFIG_VARS['platlibdir'] = sys.platlibdir
547 _CONFIG_VARS['implementation'] = _get_implementation()
548 _CONFIG_VARS['implementation_lower'] = _get_implementation().lower()
549 _CONFIG_VARS['abiflags'] = abiflags
550 try:
551 _CONFIG_VARS['py_version_nodot_plat'] = sys.winver.replace('.', '')
552 except AttributeError:
553 _CONFIG_VARS['py_version_nodot_plat'] = ''
554
555 if os.name == 'nt':
556 _init_non_posix(_CONFIG_VARS)
557 _CONFIG_VARS['VPATH'] = sys._vpath
558 if _HAS_USER_BASE:
559 # Setting 'userbase' is done below the call to the
560 # init function to enable using 'get_config_var' in
561 # the init-function.
562 _CONFIG_VARS['userbase'] = _getuserbase()
563
564 # e.g., 't' for free-threaded or '' for default build
565 _CONFIG_VARS['abi_thread'] = 't' if _CONFIG_VARS.get('Py_GIL_DISABLED') else ''
566

Callers 1

get_config_varsFunction · 0.85

Calls 10

_init_posixFunction · 0.85
_init_non_posixFunction · 0.85
get_makefile_filenameFunction · 0.85
_safe_realpathFunction · 0.85
_get_implementationFunction · 0.70
_getuserbaseFunction · 0.70
lowerMethod · 0.45
replaceMethod · 0.45
getMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected