MCPcopy Index your code
hub / github.com/python/cpython / _init_config_vars

Function _init_config_vars

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

Source from the content-addressed store, hash-verified

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

Callers 1

get_config_varsFunction · 0.85

Calls 11

_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
dirnameMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…