Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import os | |
| 7 import stat | |
| 8 import subprocess | |
| 9 import sys | |
| 10 | |
| 11 from webkitpy.common.system import filesystem | |
| 12 from webkitpy.common.webkit_finder import WebKitFinder | |
| 13 | |
| 14 PLATFORM_MAPPING = { | |
| 15 'cygwin': 'win', | |
| 16 'darwin': 'mac', | |
| 17 'linux2': 'linux', | |
| 18 'win32': 'win', | |
| 19 } | |
| 20 | |
| 21 def main(args): | |
| 22 filename = 'sky_server'; | |
| 23 if not os.path.exists(filename): | |
| 24 print >> sys.stderr, ('%s not found in the current directory.' | |
| 25 % filename) | |
| 26 return 1 | |
| 27 | |
| 28 upload_filename = filename + '_' + PLATFORM_MAPPING[sys.platform] | |
|
jamesr
2015/05/21 21:33:05
we should share this logic with the downloader scr
| |
| 29 try: | |
| 30 print 'Symlink %s to %s...' % (filename, upload_filename) | |
| 31 os.symlink(filename, upload_filename) | |
| 32 except OSError: | |
| 33 print >> sys.stderr, 'failed to create a symlink.' | |
| 34 return 2 | |
| 35 | |
| 36 finder = WebKitFinder(filesystem.FileSystem()) | |
| 37 | |
| 38 print 'Upload %s...' % upload_filename | |
| 39 subprocess.call([ | |
| 40 'upload_to_google_storage.py', | |
| 41 '--bucket', 'mojo', | |
| 42 finder.path_from_chromium_base('sky', 'tools', 'skygo', | |
| 43 upload_filename), | |
| 44 ]) | |
| 45 | |
| 46 print 'Clean up the symlink...' | |
| 47 try: | |
| 48 os.remove(upload_filename) | |
| 49 except OSError: | |
| 50 print >> sys.stderr, 'failed to remove %s.' % upload_filename | |
| 51 return 3 | |
| 52 | |
| 53 if __name__ == '__main__': | |
| 54 try: | |
| 55 sys.exit(main(sys.argv)) | |
| 56 except KeyboardInterrupt: | |
| 57 sys.stderr.write('interrupted\n') | |
| 58 sys.exit(1) | |
| OLD | NEW |