MCPcopy
hub / github.com/astral-sh/python-build-standalone / parse_config_c

Function parse_config_c

pythonbuild/cpython.py:713–742  ·  view source on GitHub ↗

Parse the contents of a config.c file. The file defines external symbols for module init functions and the mapping of module name to module initializer function.

(s: str)

Source from the content-addressed store, hash-verified

711
712
713def parse_config_c(s: str):
714 """Parse the contents of a config.c file.
715
716 The file defines external symbols for module init functions and the
717 mapping of module name to module initializer function.
718 """
719
720 # Some config.c files have #ifdef. We don't care about those because
721 # in all cases the condition is true.
722
723 extensions = {}
724
725 seen_inittab = False
726
727 for line in s.splitlines():
728 if line.startswith("struct _inittab"):
729 seen_inittab = True
730
731 if not seen_inittab:
732 continue
733
734 if "/* Sentinel */" in line:
735 break
736
737 m = RE_INITTAB_ENTRY.search(line)
738
739 if m:
740 extensions[m.group(1)] = m.group(2)
741
742 return extensions
743
744
745def extension_modules_config(yaml_path: pathlib.Path):

Callers 2

build_cpythonFunction · 0.90
derive_setup_localFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected