63 from distutils.command.build_ext import build_ext |
63 from distutils.command.build_ext import build_ext |
64 from distutils.command.build_py import build_py |
64 from distutils.command.build_py import build_py |
65 from distutils.command.install_scripts import install_scripts |
65 from distutils.command.install_scripts import install_scripts |
66 from distutils.spawn import spawn, find_executable |
66 from distutils.spawn import spawn, find_executable |
67 from distutils.ccompiler import new_compiler |
67 from distutils.ccompiler import new_compiler |
|
68 from distutils import cygwinccompiler |
68 from distutils.errors import CCompilerError, DistutilsExecError |
69 from distutils.errors import CCompilerError, DistutilsExecError |
69 from distutils.sysconfig import get_python_inc |
70 from distutils.sysconfig import get_python_inc |
70 from distutils.version import StrictVersion |
71 from distutils.version import StrictVersion |
71 |
72 |
72 convert2to3 = '--c2to3' in sys.argv |
73 convert2to3 = '--c2to3' in sys.argv |
427 pymodules.append('mercurial.pure.osutil') |
428 pymodules.append('mercurial.pure.osutil') |
428 else: |
429 else: |
429 extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'], |
430 extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'], |
430 extra_link_args=osutil_ldflags)) |
431 extra_link_args=osutil_ldflags)) |
431 |
432 |
|
433 # the -mno-cygwin option has been deprecated for years |
|
434 Mingw32CCompiler = cygwinccompiler.Mingw32CCompiler |
|
435 |
|
436 class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler): |
|
437 def __init__(self, *args, **kwargs): |
|
438 Mingw32CCompiler.__init__(self, *args, **kwargs) |
|
439 for i in 'compiler compiler_so linker_exe linker_so'.split(): |
|
440 try: |
|
441 getattr(self, i).remove('-mno-cygwin') |
|
442 except ValueError: |
|
443 pass |
|
444 |
|
445 cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler |
|
446 |
432 if sys.platform.startswith('linux') and os.uname()[2] > '2.6': |
447 if sys.platform.startswith('linux') and os.uname()[2] > '2.6': |
433 # The inotify extension is only usable with Linux 2.6 kernels. |
448 # The inotify extension is only usable with Linux 2.6 kernels. |
434 # You also need a reasonably recent C library. |
449 # You also need a reasonably recent C library. |
435 # In any case, if it fails to build the error will be skipped ('optional'). |
450 # In any case, if it fails to build the error will be skipped ('optional'). |
436 cc = new_compiler() |
451 cc = new_compiler() |