2

My software performs some generation and compilation of C code under the hood. I control this with Python’s Setuptools, which calls a C compiler of its own choice – on Windows this defaults to MSVC. Now when compiling, MSVC emits messages like:

{{filename}}
Creating library C:\{{path}}
Generating code
Finished generating code

(The reason for this has already been asked here.) For my users, this is obstructive and confusing (since my software also generates code). Therefore I wish to disable these messages via a compiler option, environment variable, or similar, i.e., in a way that can be controlled in my setting.

What I tried so far or what doesn’t work:

  • I could not find anything useful in the list of compiler options using keywords like message, verbos*, status, generat*, etc.

  • Internet searches only return instructions (such as here) on how to click this or command-line options for other executables (that are not listed for MSVC).

  • Setuptools’ verbose argument is already set to False, but I do not think that the solution lies within Setuptools, as this also happens when calling MSVC manually.

Wrzlprmft
  • 4,234
  • 1
  • 28
  • 54
  • `cl some commands > nul:` perhaps? – Igor Tandetnik Mar 16 '18 at 00:33
  • @IgorTandetnik: I do not think I can wrap something around the compiler command with Setuptools. Also, this would suppress all output (except errors, perhaps), wouldn’t it? – Wrzlprmft Mar 16 '18 at 06:49
  • Write your own wrapper that would launch `cl` with [redirected standard streams](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499.aspx), and filter its output as you see fit. Configure your build tool to launch your wrapper as the compiler. Maybe even just a `.bat` file that launches `cl` and pipes its output through `grep` or similar. – Igor Tandetnik Mar 16 '18 at 12:50
  • That sounds like it should be posted as an answer. (Apart from that it seems like a nightmare in terms of required effort, portability, and maintainability to me.) – Wrzlprmft Mar 16 '18 at 12:53

0 Answers0