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

Function get_config_vars

Lib/sysconfig/__init__.py:594–631  ·  view source on GitHub ↗

With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows it's a much smaller set. With arguments, return a list of values that result from looking u

(*args)

Source from the content-addressed store, hash-verified

592
593
594def get_config_vars(*args):
595 """With no arguments, return a dictionary of all configuration
596 variables relevant for the current platform.
597
598 On Unix, this means every variable defined in Python's installed Makefile;
599 On Windows it's a much smaller set.
600
601 With arguments, return a list of values that result from looking up
602 each argument in the configuration variable dictionary.
603 """
604 global _CONFIG_VARS_INITIALIZED
605
606 # Avoid claiming the lock once initialization is complete.
607 if _CONFIG_VARS_INITIALIZED:
608 # GH-126789: If sys.prefix or sys.exec_prefix were updated, invalidate the cache.
609 prefix = os.path.normpath(sys.prefix)
610 exec_prefix = os.path.normpath(sys.exec_prefix)
611 if _CONFIG_VARS['prefix'] != prefix or _CONFIG_VARS['exec_prefix'] != exec_prefix:
612 with _CONFIG_VARS_LOCK:
613 _CONFIG_VARS_INITIALIZED = False
614 _init_config_vars()
615 else:
616 # Initialize the config_vars cache.
617 with _CONFIG_VARS_LOCK:
618 # Test again with the lock held to avoid races. Note that
619 # we test _CONFIG_VARS here, not _CONFIG_VARS_INITIALIZED,
620 # to ensure that recursive calls to get_config_vars()
621 # don't re-enter init_config_vars().
622 if _CONFIG_VARS is None:
623 _init_config_vars()
624
625 if args:
626 vals = []
627 for name in args:
628 vals.append(_CONFIG_VARS.get(name))
629 return vals
630 else:
631 return _CONFIG_VARS
632
633
634def get_config_var(name):

Callers 9

_generate_posix_varsFunction · 0.90
_mainFunction · 0.90
test_get_pathMethod · 0.90
test_get_config_varsMethod · 0.90
test_get_platformMethod · 0.90
_expand_varsFunction · 0.85
get_config_varFunction · 0.85
get_platformFunction · 0.85

Calls 3

_init_config_varsFunction · 0.85
appendMethod · 0.45
getMethod · 0.45

Tested by 4

test_get_pathMethod · 0.72
test_get_config_varsMethod · 0.72
test_get_platformMethod · 0.72