Index: sky/tools/upload_sky_server |
diff --git a/sky/tools/upload_sky_server b/sky/tools/upload_sky_server |
new file mode 100755 |
index 0000000000000000000000000000000000000000..bdf114e2499e88ed2fa6c2e35943eed8093c6f10 |
--- /dev/null |
+++ b/sky/tools/upload_sky_server |
@@ -0,0 +1,58 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2015 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import os |
+import stat |
+import subprocess |
+import sys |
+ |
+from webkitpy.common.system import filesystem |
+from webkitpy.common.webkit_finder import WebKitFinder |
+ |
+PLATFORM_MAPPING = { |
+ 'cygwin': 'win', |
+ 'darwin': 'mac', |
+ 'linux2': 'linux', |
+ 'win32': 'win', |
+} |
+ |
+def main(args): |
+ filename = 'sky_server'; |
+ if not os.path.exists(filename): |
+ print >> sys.stderr, ('%s not found in the current directory.' |
+ % filename) |
+ return 1 |
+ |
+ upload_filename = filename + '_' + PLATFORM_MAPPING[sys.platform] |
jamesr
2015/05/21 21:33:05
we should share this logic with the downloader scr
|
+ try: |
+ print 'Symlink %s to %s...' % (filename, upload_filename) |
+ os.symlink(filename, upload_filename) |
+ except OSError: |
+ print >> sys.stderr, 'failed to create a symlink.' |
+ return 2 |
+ |
+ finder = WebKitFinder(filesystem.FileSystem()) |
+ |
+ print 'Upload %s...' % upload_filename |
+ subprocess.call([ |
+ 'upload_to_google_storage.py', |
+ '--bucket', 'mojo', |
+ finder.path_from_chromium_base('sky', 'tools', 'skygo', |
+ upload_filename), |
+ ]) |
+ |
+ print 'Clean up the symlink...' |
+ try: |
+ os.remove(upload_filename) |
+ except OSError: |
+ print >> sys.stderr, 'failed to remove %s.' % upload_filename |
+ return 3 |
+ |
+if __name__ == '__main__': |
+ try: |
+ sys.exit(main(sys.argv)) |
+ except KeyboardInterrupt: |
+ sys.stderr.write('interrupted\n') |
+ sys.exit(1) |