Use xcrun to find path to make for Mac port
[WebKit-https.git] / Tools / Scripts / webkitpy / layout_tests / port / mac.py
index c5b2bbc1f1e73fbaeaa4f7a7a231314dc4273347..30b3255dbd68c7609d54fa3b8ff163c08c7ca668 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright (C) 2011 Google Inc. All rights reserved.
-# Copyright (C) 2012 Apple Inc. All rights reserved.
+# Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -130,7 +130,7 @@ class MacPort(ApplePort):
 
     def _build_java_test_support(self):
         java_tests_path = self._filesystem.join(self.layout_tests_dir(), "java")
-        build_java = ["/usr/bin/make", "-C", java_tests_path]
+        build_java = [self.make_command(), "-C", java_tests_path]
         if self._executive.run_command(build_java, return_exit_code=True):  # Paths are absolute, so we don't need to set a cwd.
             _log.error("Failed to build Java support files: %s" % build_java)
             return False
@@ -268,9 +268,15 @@ class MacPort(ApplePort):
                 _log.debug("IOError raised while stopping helper: %s" % str(e))
             self._helper = None
 
+    def make_command(self):
+        return self.xcrun_find('make', '/usr/bin/make')
+
     def nm_command(self):
+        return self.xcrun_find('nm', 'nm')
+
+    def xcrun_find(self, command, fallback):
         try:
-            return self._executive.run_command(['xcrun', '-find', 'nm']).rstrip()
+            return self._executive.run_command(['xcrun', '-find', command]).rstrip()
         except ScriptError:
-            _log.warn("xcrun failed; falling back to 'nm'.")
-            return 'nm'
+            _log.warn("xcrun failed; falling back to '%s'." % fallback)
+            return fallback