Message189874
Oscar Benjamin wrote:
> Oscar Benjamin added the comment:
>
> 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
> try:
> out_string = out.read()
> finally:
> out.close()
> # 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:
> http://permalink.gmane.org/gmane.comp.gnu.mingw.user/42137
>
> With this the Mingw32CCompiler.__init__ method can be modified to do:
>
> if self.gcc_version < '4' or is_cygwingcc():
It seems to me you try to find another method to detect support of some
options.
Where is written that compiler is gcc ? Yes this is current distutils
code but please review my set of patches
> no_cygwin = ' -mno-cygwin'
> else:
> 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 not work in new cygwin (1.7) environment with true
cross-compilers.
Reason is simple - executable is not gcc.
> 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?
It is not enough.
> Thanks,
> Oscar
>
> ----------
>
Roumen |
|
Date |
User |
Action |
Args |
2013-05-23 19:11:39 | rpetrov | set | recipients:
+ rpetrov, loewis, doko, paul.moore, pje, geertj, schmir, tarek, jwilk, eric.araujo, cmcqueen1975, rubenvb, santoso.wijaya, alexis, Seppo.Yli-Olli, jonforums, RubyTuesdayDONO, Jeffrey.Armstrong, danmbox, Martin.Fiers, oscarbenjamin, Pete.Forman |
2013-05-23 19:11:39 | rpetrov | link | issue12641 messages |
2013-05-23 19:11:39 | rpetrov | create | |
|