This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author oscarbenjamin
Recipients Jeffrey.Armstrong, Martin.Fiers, Pete.Forman, RubyTuesdayDONO, Seppo.Yli-Olli, alexis, cmcqueen1975, danmbox, doko, eric.araujo, geertj, jonforums, jwilk, loewis, oscarbenjamin, paul.moore, pje, rpetrov, rubenvb, santoso.wijaya, schmir, tarek
Date 2013-05-23.17:57:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
I have written a function that can be used to determine if the gcc
that distutils will use is from Cygwin or MinGW:

def is_cygwingcc():
    '''Try to determine if the gcc that would be used is from cygwin.'''
    out = Popen(['gcc', '-dumpmachine'], shell=True, stdout=PIPE).stdout
        out_string =
    # out_string is the target triplet cpu-vendor-os
    # Cygwin's gcc sets the os to 'cygwin'
    return out_string.strip().endswith('cygwin')

The idea is that 'gcc -dumpmachine' emits a string that always ends in
'cygwin' for the Cygwin gcc (please let me know if I'm wrong about
that). Earnie Boyd at mingw-users described this method for
distinguishing MinGW and Cygwin gcc as not being a bad idea:

With this the Mingw32CCompiler.__init__ method can be modified to do:

if self.gcc_version < '4' or is_cygwingcc():
    no_cygwin = ' -mno-cygwin'
    no_cygwin = ''

self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin,
                     compiler_so='gcc%s -mdll -O -Wall' % no_cygwin,
                     compiler_cxx='g++%s -O -Wall' % no_cygwin,
                     linker_exe='gcc%s' % no_cygwin,
                     linker_so='%s%s %s %s'
                            % (self.linker_dll, no_cygwin,
                               shared_option, entry_point))

This will fix the problem for MinGW, should not break existing
no-cygwin/gcc 3.x setups and preserves the error message currently
seen for no-cygwin with gcc 4.x. In other words it should satisfy
users in all three groups A, B and C referred to above. In particular
the is_cygwingcc() function hopefully addresses Martin's concern for
users in group C.

Is this approach acceptable?

Date User Action Args
2013-05-23 17:57:54oscarbenjaminsetrecipients: + oscarbenjamin, loewis, doko, paul.moore, pje, geertj, schmir, tarek, jwilk, eric.araujo, rpetrov, cmcqueen1975, rubenvb, santoso.wijaya, alexis, Seppo.Yli-Olli, jonforums, RubyTuesdayDONO, Jeffrey.Armstrong, danmbox, Martin.Fiers, Pete.Forman
2013-05-23 17:57:54oscarbenjaminlinkissue12641 messages
2013-05-23 17:57:53oscarbenjamincreate