##// END OF EJS Templates
setup.py: fix C extension compilation issue with OS X 10.9 and Xcode 5.1
Kent Frazier -
r21038:440fbe52 default
parent child Browse files
Show More
@@ -61,6 +61,7 b' else:'
61 "Couldn't import standard bz2 (incomplete Python install).")
61 "Couldn't import standard bz2 (incomplete Python install).")
62
62
63 import os, subprocess, time
63 import os, subprocess, time
64 import re
64 import shutil
65 import shutil
65 import tempfile
66 import tempfile
66 from distutils import log
67 from distutils import log
@@ -73,7 +74,7 b' from distutils.command.install_scripts i'
73 from distutils.spawn import spawn, find_executable
74 from distutils.spawn import spawn, find_executable
74 from distutils import cygwinccompiler
75 from distutils import cygwinccompiler
75 from distutils.errors import CCompilerError, DistutilsExecError
76 from distutils.errors import CCompilerError, DistutilsExecError
76 from distutils.sysconfig import get_python_inc
77 from distutils.sysconfig import get_python_inc, get_config_var
77 from distutils.version import StrictVersion
78 from distutils.version import StrictVersion
78
79
79 convert2to3 = '--c2to3' in sys.argv
80 convert2to3 = '--c2to3' in sys.argv
@@ -505,22 +506,36 b" if os.name == 'nt':"
505 setupversion = version.split('+', 1)[0]
506 setupversion = version.split('+', 1)[0]
506
507
507 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
508 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
508 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
509 # distutils.sysconfig
510 version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()
509 version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()
511 if version:
510 if version:
512 version = version[0]
511 version = version[0]
513 xcode4 = (version.startswith('Xcode') and
512 xcode4 = (version.startswith('Xcode') and
514 StrictVersion(version.split()[1]) >= StrictVersion('4.0'))
513 StrictVersion(version.split()[1]) >= StrictVersion('4.0'))
514 xcode51 = re.match(r'^Xcode\s+5\.1\.', version) is not None
515 else:
515 else:
516 # xcodebuild returns empty on OS X Lion with XCode 4.3 not
516 # xcodebuild returns empty on OS X Lion with XCode 4.3 not
517 # installed, but instead with only command-line tools. Assume
517 # installed, but instead with only command-line tools. Assume
518 # that only happens on >= Lion, thus no PPC support.
518 # that only happens on >= Lion, thus no PPC support.
519 xcode4 = True
519 xcode4 = True
520 xcode51 = False
520
521
522 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
523 # distutils.sysconfig
521 if xcode4:
524 if xcode4:
522 os.environ['ARCHFLAGS'] = ''
525 os.environ['ARCHFLAGS'] = ''
523
526
527 # XCode 5.1 changes clang such that it now fails to compile if the
528 # -mno-fused-madd flag is passed, but the version of Python shipped with
529 # OS X 10.9 Mavericks includes this flag. This causes problems in all
530 # C extension modules, and a bug has been filed upstream at
531 # http://bugs.python.org/issue21244. We also need to patch this here
532 # so Mercurial can continue to compile in the meantime.
533 if xcode51:
534 cflags = get_config_var('CFLAGS')
535 if re.search(r'-mno-fused-madd\b', cflags) is not None:
536 os.environ['CFLAGS'] = (
537 os.environ.get('CFLAGS', '') + ' -Qunused-arguments')
538
524 setup(name='mercurial',
539 setup(name='mercurial',
525 version=setupversion,
540 version=setupversion,
526 author='Matt Mackall and many others',
541 author='Matt Mackall and many others',
General Comments 0
You need to be logged in to leave comments. Login now