Sunday, April 7, 2013

The -mno-cygwin option has been deprecated for years

[UPDATE: 2015-03-19] Yay! Issue #12641 was closed in September-2013, and the latest releases of Python>=2.7.6 no longer have it.

So true. And there's even a bug filed in Python tracker. I also talked about it in this post. Here's how they deal with it in Mercurial (a.k.a. Hg).

# the -mno-cygwin option has been deprecated for years
Mingw32CCompiler = cygwinccompiler.Mingw32CCompiler
class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
    def __init__(self, *args, **kwargs):
        Mingw32CCompiler.__init__(self, *args, **kwargs)
        for i in 'compiler compiler_so linker_exe linker_so'.split():
            try:
                getattr(self, i).remove('-mno-cygwin')
            except ValueError:
                passcygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler
Fork me on GitHub