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

Function _build_argv

Tools/c-analyzer/c_parser/preprocessor/common.py:71–104  ·  view source on GitHub ↗
(
    tool,
    filename,
    incldirs=None,
    includes=None,
    macros=None,
    preargs=None,
    postargs=None,
    executable=None,
    compiler=None,
)

Source from the content-addressed store, hash-verified

69
70
71def _build_argv(
72 tool,
73 filename,
74 incldirs=None,
75 includes=None,
76 macros=None,
77 preargs=None,
78 postargs=None,
79 executable=None,
80 compiler=None,
81):
82 if includes:
83 includes = tuple(f'-include{i}' for i in includes)
84 postargs = (includes + postargs) if postargs else includes
85
86 compiler = distutils.ccompiler.new_compiler(
87 compiler=compiler or tool,
88 )
89 if executable:
90 compiler.set_executable('preprocessor', executable)
91
92 argv = None
93 def _spawn(_argv):
94 nonlocal argv
95 argv = _argv
96 compiler.spawn = _spawn
97 compiler.preprocess(
98 filename,
99 macros=[tuple(v) for v in macros or ()],
100 include_dirs=incldirs or (),
101 extra_preargs=preargs or (),
102 extra_postargs=postargs or (),
103 )
104 return argv
105
106
107@contextlib.contextmanager

Callers 1

preprocessFunction · 0.85

Calls 2

set_executableMethod · 0.45
preprocessMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…