[Distutils] MSToolkit and --debug-on-release for MSVCCompiler

Thomas Heller theller at python.net
Tue Oct 19 19:57:27 CEST 2004

"Mike C. Fletcher" <mcfletch at rogers.com> writes:

> The debug-on-release recipe consists entirely of altering the
> compile_options and ldflags_shared properties of the compiler object.
> Problem is, the compiler API assumes that debug is a boolean flag, and
> AFAICT, has no access to the options the user passed in to whatever
> command is calling the compiler.  As a result, it looks like it would
> be necessary to provide a compiler sub-class, one where specifying
> debug causes a debug-on-release set of options to be used.  That seems
> silly, as it's just a feature of the MSVC compilers.  Still, don't see
> any other elegant way to approach the problem.  That said, this is a
> comparatively minor feature (which I'm told isn't really a *great*
> idea, no matter how practical/useful), so no big deal to keep having
> people do it with diffs.

I think you could make a subclass of build_ext, and override the
build_extensions() method.  You can then replace it's
self.compiler.ldflags_shared and self.compiler.compile_options, maybe
depending on a new 'fake-debug' command line flag or something like


More information about the Distutils-SIG mailing list