Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Unified Diff: test/mac/gyptest-sdkroot.py

Issue 83073002: Fix gyptest-sdkroot when oldest SDK is >= 10.8 (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mac/sdkroot/test_shorthand.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mac/gyptest-sdkroot.py
diff --git a/test/mac/gyptest-sdkroot.py b/test/mac/gyptest-sdkroot.py
index 20edd365d99312686599d3a67fe93938774553ab..711726ed87c5b2cfc52ac220dea1f281a9fc6044 100644
--- a/test/mac/gyptest-sdkroot.py
+++ b/test/mac/gyptest-sdkroot.py
@@ -17,22 +17,29 @@ import sys
if sys.platform == 'darwin':
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
+ def GetSDKPath(sdk):
+ """Return SDKROOT if the SDK version |sdk| is installed or empty string."""
+ DEVNULL = open(os.devnull, 'wb')
+ try:
+ proc = subprocess.Popen(
+ ['xcodebuild', '-version', '-sdk', 'macosx' + sdk, 'Path'],
+ stdout=subprocess.PIPE, stderr=DEVNULL)
+ return proc.communicate()[0].rstrip('\n')
+ finally:
+ DEVNULL.close()
+
+ def SelectSDK():
+ """Select the oldest SDK installed (greater than 10.6)."""
+ for sdk in ['10.6', '10.7', '10.8', '10.9']:
+ path = GetSDKPath(sdk)
+ if path:
+ return True, sdk, path
+ return False, '', ''
+
# Make sure this works on the bots, which only have the 10.6 sdk, and on
- # dev machines, which usually don't have the 10.6 sdk.
- sdk = '10.6'
- DEVNULL = open(os.devnull, 'wb')
- proc = subprocess.Popen(['xcodebuild', '-version', '-sdk', 'macosx' + sdk],
- stdout=DEVNULL, stderr=DEVNULL)
- proc.communicate()
- DEVNULL.close()
- if proc.returncode:
- sdk = '10.7'
-
- proc = subprocess.Popen(['xcodebuild', '-version',
- '-sdk', 'macosx' + sdk, 'Path'],
- stdout=subprocess.PIPE)
- sdk_path = proc.communicate()[0].rstrip('\n')
- if proc.returncode != 0:
+ # dev machines which usually don't have the 10.6 sdk.
+ sdk_found, sdk, sdk_path = SelectSDK()
+ if not sdk_found:
test.fail_test()
test.write('sdkroot/test.gyp', test.read('sdkroot/test.gyp') % sdk)
« no previous file with comments | « no previous file | test/mac/sdkroot/test_shorthand.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698