Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/distutils/cygwinccompiler.py

    r2 r391  
    4848# This module should be kept compatible with Python 2.1.
    4949
    50 __revision__ = "$Id: cygwinccompiler.py 73349 2009-06-11 09:17:19Z tarek.ziade $"
     50__revision__ = "$Id$"
    5151
    5252import os,sys,copy
     
    320320            entry_point = ''
    321321
    322         self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
    323                              compiler_so='gcc -mno-cygwin -mdll -O -Wall',
    324                              compiler_cxx='g++ -mno-cygwin -O -Wall',
    325                              linker_exe='gcc -mno-cygwin',
    326                              linker_so='%s -mno-cygwin %s %s'
    327                                         % (self.linker_dll, shared_option,
    328                                            entry_point))
     322        if self.gcc_version < '4' or is_cygwingcc():
     323            no_cygwin = ' -mno-cygwin'
     324        else:
     325            no_cygwin = ''
     326
     327        self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin,
     328                             compiler_so='gcc%s -mdll -O -Wall' % no_cygwin,
     329                             compiler_cxx='g++%s -O -Wall' % no_cygwin,
     330                             linker_exe='gcc%s' % no_cygwin,
     331                             linker_so='%s%s %s %s'
     332                                    % (self.linker_dll, no_cygwin,
     333                                       shared_option, entry_point))
    329334        # Maybe we should also append -mthreads, but then the finished
    330335        # dlls need another dll (mingwm10.dll see Mingw32 docs)
     
    383388        # But we do this only once, and it is fast enough
    384389        f = open(fn)
    385         s = f.read()
    386         f.close()
     390        try:
     391            s = f.read()
     392        finally:
     393            f.close()
    387394
    388395    except IOError, exc:
     
    446453        dllwrap_version = None
    447454    return (gcc_version, ld_version, dllwrap_version)
     455
     456def is_cygwingcc():
     457    '''Try to determine if the gcc that would be used is from cygwin.'''
     458    out = os.popen('gcc -dumpmachine', 'r')
     459    out_string = out.read()
     460    out.close()
     461    # out_string is the target triplet cpu-vendor-os
     462    # Cygwin's gcc sets the os to 'cygwin'
     463    return out_string.strip().endswith('cygwin')
Note: See TracChangeset for help on using the changeset viewer.