... CWD should be the project root and "source" should be relative.
(source, *,
incldirs=None,
includes=None,
macros=None,
samefiles=None,
filename=None,
cwd=None,
tool=True,
)
| 36 | # XXX Add more low-level functions to handle permutations? |
| 37 | |
| 38 | def preprocess(source, *, |
| 39 | incldirs=None, |
| 40 | includes=None, |
| 41 | macros=None, |
| 42 | samefiles=None, |
| 43 | filename=None, |
| 44 | cwd=None, |
| 45 | tool=True, |
| 46 | ): |
| 47 | """... |
| 48 | |
| 49 | CWD should be the project root and "source" should be relative. |
| 50 | """ |
| 51 | if tool: |
| 52 | if not cwd: |
| 53 | cwd = os.getcwd() |
| 54 | logger.debug(f'CWD: {cwd!r}') |
| 55 | logger.debug(f'incldirs: {incldirs!r}') |
| 56 | logger.debug(f'includes: {includes!r}') |
| 57 | logger.debug(f'macros: {macros!r}') |
| 58 | logger.debug(f'samefiles: {samefiles!r}') |
| 59 | _preprocess = _get_preprocessor(tool) |
| 60 | with _good_file(source, filename) as source: |
| 61 | return _preprocess( |
| 62 | source, |
| 63 | incldirs, |
| 64 | includes, |
| 65 | macros, |
| 66 | samefiles, |
| 67 | cwd, |
| 68 | ) or () |
| 69 | else: |
| 70 | source, filename = _resolve_source(source, filename) |
| 71 | # We ignore "includes", "macros", etc. |
| 72 | return _pure.preprocess(source, filename, cwd) |
| 73 | |
| 74 | # if _run() returns just the lines: |
| 75 | # text = _run(source) |
| 76 | # lines = [line + os.linesep for line in text.splitlines()] |
| 77 | # lines[-1] = lines[-1].splitlines()[0] |
nothing calls this directly
no test coverage detected
searching dependent graphs…