[PATCH STABLE] setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward
greg at gerg.ca
Mon Feb 27 13:55:15 UTC 2012
# HG changeset patch
# User Greg Ward <greg at gerg.ca>
# Date 1330350866 18000
# Branch stable
# Node ID f8d84a280ae81c5ef33451b9e419269cf212fa81
# Parent 280e834c9d15b0d65a0ee24374671e0cd2147f4e
setup: handle output from Apple's Xcode 4.3 better (issue3277)
Apparently, it prints nothing at all if the user installed only the
command-line tools. In that case, don't try to parse the empty output
-- just assume they have Xcode >= 4.
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -452,10 +452,18 @@
if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
# XCode 4.0 dropped support for ppc architecture, which is hardcoded in
# distutils.sysconfig
- version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()[0]
- # Also parse only first digit, because 3.2.1 can't be parsed nicely
- if (version.startswith('Xcode') and
- StrictVersion(version.split()[1]) >= StrictVersion('4.0')):
+ version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()
+ if version:
+ version = version.splitlines()[0]
+ xcode4 = (version.startswith('Xcode') and
+ StrictVersion(version.split()[1]) >= StrictVersion('4.0'))
+ else:
+ # xcodebuild returns empty on OS X Lion with XCode 4.3 not
+ # installed, but instead with only command-line tools. Assume
+ # that only happens on >= Lion, thus no PPC support.
+ xcode4 = True
+
+ if xcode4:
os.environ['ARCHFLAGS'] = ''
setup(name='mercurial',
More information about the Mercurial-devel
mailing list