sysconfig.parse_config_h
Prev: sysconfig.get_scheme_names | Up: sysconfig
Rel: sysconfig.get_config_h_filename, sysconfig.get_config_var, sysconfig.get_config_vars, sysconfig.get_makefile_filename
Ref: docs.python.org — sysconfig.parse_config_h
Tags: #public #python3 #stdlib #sysconfig
Import
import sysconfig
from sysconfig import parse_config_h
Signature & Overview
sysconfig.parse_config_h(fp, vars=None)
Parse a config.h-style file.
Usage
import io, sysconfig
parsed = sysconfig.parse_config_h(io.StringIO('#define HAVE_FOO 1\n/* #undef HAVE_BAR */\n'))
assert parsed['HAVE_FOO'] == 1 and parsed['HAVE_BAR'] == 0
Gotchas
- Parses C
#define/#undefheaders into a Python dict.
REPL Inspect
from sysconfig import parse_config_h
help(parse_config_h)
Linked from
Related notes
- tuts/python3/stdlib_module/sysconfig/get_scheme_names Linked here; links to this page; shared tags: #stdlib, #sysconfig
- tuts/python3/stdlib_module/sysconfig Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sysconfig/get_config_h_filename Linked here; shared tags: #stdlib, #sysconfig
- tuts/python3/stdlib_module/sysconfig/get_config_var Linked here; shared tags: #stdlib, #sysconfig
- tuts/python3/stdlib_module/sysconfig/get_config_vars Linked here; shared tags: #stdlib, #sysconfig
- tuts/python3/stdlib_module/sysconfig/get_makefile_filename Linked here; shared tags: #stdlib, #sysconfig
- tuts/python3/stdlib_module/sysconfig/get_path shared tags: #stdlib, #sysconfig
- tuts/python3/stdlib_module/sysconfig/get_path_names shared tags: #stdlib, #sysconfig
- tuts/python3/stdlib_module/sysconfig/get_paths shared tags: #stdlib, #sysconfig
- tuts/python3/stdlib_module/sysconfig/get_platform shared tags: #stdlib, #sysconfig