setup.py
branchstable
changeset 16187 82ce91a9fd94
parent 15527 9926aab3d0b5
child 16209 5536770b3c88
--- a/setup.py	Sat Feb 18 16:30:17 2012 -0500
+++ b/setup.py	Mon Feb 27 08:54:26 2012 -0500
@@ -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',