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

Function preprocess

Tools/c-analyzer/c_parser/preprocessor/gcc.py:71–101  ·  view source on GitHub ↗
(filename,
               incldirs=None,
               includes=None,
               macros=None,
               samefiles=None,
               cwd=None,
               )

Source from the content-addressed store, hash-verified

69
70
71def preprocess(filename,
72 incldirs=None,
73 includes=None,
74 macros=None,
75 samefiles=None,
76 cwd=None,
77 ):
78 if not cwd or not os.path.isabs(cwd):
79 cwd = os.path.abspath(cwd or '.')
80 filename = _normpath(filename, cwd)
81
82 postargs = POST_ARGS
83 basename = os.path.basename(filename)
84 dirname = os.path.basename(os.path.dirname(filename))
85 if (basename not in FILES_WITHOUT_INTERNAL_CAPI
86 and dirname not in DIRS_WITHOUT_INTERNAL_CAPI):
87 postargs += ('-DPy_BUILD_CORE=1',)
88
89 text = _common.preprocess(
90 TOOL,
91 filename,
92 incldirs=incldirs,
93 includes=includes,
94 macros=macros,
95 #preargs=PRE_ARGS,
96 postargs=postargs,
97 executable=['gcc'],
98 compiler='unix',
99 cwd=cwd,
100 )
101 return _iter_lines(text, filename, samefiles, cwd)
102
103
104def _iter_lines(text, reqfile, samefiles, cwd, raw=False):

Callers 2

_iter_preprocessedFunction · 0.70
_parse_fileFunction · 0.50

Calls 7

_normpathFunction · 0.85
_iter_linesFunction · 0.70
isabsMethod · 0.45
abspathMethod · 0.45
basenameMethod · 0.45
dirnameMethod · 0.45
preprocessMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…