Selaa lähdekoodia

Tweak xcodebuild hack to deal with more error output.

Jelmer Vernooij 13 vuotta sitten
vanhempi
commit
8fcc2b3c06
2 muutettua tiedostoa jossa 13 lisäystä ja 18 poistoa
  1. 3 0
      NEWS
  2. 10 18
      setup.py

+ 3 - 0
NEWS

@@ -15,6 +15,9 @@
   * Properly abort connections when the determine_wants function
     raises an exception. (Jelmer Vernooij, #856769)
 
+  * Tweak xcodebuild hack to deal with more error output.
+    (Jelmer Vernooij, #903840)
+
  FEATURES
 
   * Add support for retrieving tarballs from remote servers.

+ 10 - 18
setup.py

@@ -35,27 +35,19 @@ class DulwichDistribution(Distribution):
 
     pure = False
 
-def runcmd(cmd, env):
-    import subprocess
-    p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-                         stderr=subprocess.PIPE, env=env)
-    out, err = p.communicate()
-    err = [e for e in err.splitlines()
-           if not e.startswith('Not trusting file') \
-              and not e.startswith('warning: Not importing')]
-    if err:
-        return ''
-    return out
-
-
 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'], {}).splitlines()[0]
-    # Also parse only first digit, because 3.2.1 can't be parsed nicely
-    if (version.startswith('Xcode') and
-        int(version.split()[1].split('.')[0]) >= 4):
-        os.environ['ARCHFLAGS'] = ''
+    import subprocess
+    p = subprocess.Popen(
+        ['/usr/bin/xcodebuild', '-version'], stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE, env={})
+    out, err = p.communicate()
+    for l in out.splitlines():
+        # Also parse only first digit, because 3.2.1 can't be parsed nicely
+        if (l.startswith('Xcode') and
+            int(l.split()[1].split('.')[0]) >= 4):
+            os.environ['ARCHFLAGS'] = ''
 
 setup_kwargs = {}