(
tool,
filename,
incldirs=None,
includes=None,
macros=None,
preargs=None,
postargs=None,
executable=None,
compiler=None,
)
| 69 | |
| 70 | |
| 71 | def _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 |
no test coverage detected
searching dependent graphs…