Index: chrome/tools/build/mac/copy_keystone_framework.py |
diff --git a/chrome/tools/build/mac/copy_keystone_framework.py b/chrome/tools/build/mac/copy_keystone_framework.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5d7a654216a290a537b04a8f592dca8cc49e2e29 |
--- /dev/null |
+++ b/chrome/tools/build/mac/copy_keystone_framework.py |
@@ -0,0 +1,39 @@ |
+# Copyright 2016 The Chromium Authors. All rights reserved. |
Mark Mentovai
2016/05/18 17:53:10
#!/usr/bin/env python
Robert Sesek
2016/05/18 18:36:25
This isn't done for GN scripts because GN explicit
Mark Mentovai
2016/05/18 18:40:11
Then put python in the usage on line 10, because i
Robert Sesek
2016/05/18 18:43:45
Done.
|
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import os.path |
+import shutil |
+import subprocess |
+import sys |
+ |
+# Usage: copy_keystone_framework.py /path/to/input /path/to/output |
+# |
+# This script copies the KeystoneRegistration.framework, removing its |
+# versioned directory structure, thinning it to just x86_64, and deleting |
+# the Headers directory. |
+ |
+def Main(args): |
+ if len(args) != 3: |
+ print >> sys.stderr, '%s: /path/to/input /path/to/output' % (args[0],) |
+ return 1 |
+ |
+ # Delete any old copies of the framework. |
+ output_path = os.path.join(args[2], 'KeystoneRegistration.framework') |
+ if os.path.exists(output_path): |
+ shutil.rmtree(output_path) |
+ |
+ # Copy the framework out of its versioned directory. |
+ shutil.copytree(os.path.join(args[1], 'Versions/A'), output_path) |
Mark Mentovai
2016/05/18 17:53:10
os.readlink(os.path.join(args[1], 'Versions/Curren
Robert Sesek
2016/05/18 18:36:25
Switched to using rsync and Versions/Current/ so d
Mark Mentovai
2016/05/18 18:40:11
Robert Sesek wrote:
|
+ |
+ # Strip headers from the shipped product. |
Mark Mentovai
2016/05/18 17:53:10
Lose PrivateHeaders too, unless it’s an error to r
Robert Sesek
2016/05/18 18:36:25
Switched to rsync using the same incantation as co
|
+ shutil.rmtree(os.path.join(output_path, 'Headers')) |
+ |
+ # Thin the library to just the required arch. |
+ library_path = os.path.join(output_path, 'KeystoneRegistration') |
+ return subprocess.check_call( |
Mark Mentovai
2016/05/18 17:53:11
check_call won’t return nonzero, but hiding that z
Robert Sesek
2016/05/18 18:36:25
Done.
|
+ ['lipo', '-thin', 'x86_64', library_path, '-o', library_path]) |
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(Main(sys.argv)) |