Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # | |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 4 # for details. All rights reserved. Use of this source code is governed by a | |
| 5 # BSD-style license that can be found in the LICENSE file. | |
| 6 | |
| 7 import platform | |
| 8 import subprocess | |
| 9 import sys | |
| 10 sys.path.insert(0, '../../../tools') | |
|
Emily Fortuna
2013/07/10 21:23:32
sys.path.append(and then again, get an absolute pa
| |
| 11 import utils | |
| 12 | |
|
Emily Fortuna
2013/07/10 21:23:32
please add a doc comment """...""" explaining how
| |
| 13 DART = '../../../' + utils.BUILD_ROOT[utils.GuessOS()] \ | |
|
Emily Fortuna
2013/07/10 21:23:32
absolute path is better than a relative path becau
| |
| 14 + '/ReleaseIA32/dart-sdk/bin/dart' | |
|
Emily Fortuna
2013/07/10 21:23:32
+2 spaces. Also you can group this in () instead o
janicejl
2013/07/11 00:02:08
Done.
| |
| 15 GSUTIL = '../../../third_party/gsutil/gsutil' | |
|
Emily Fortuna
2013/07/10 21:23:32
please create an absoulte path instead.
janicejl
2013/07/11 00:02:08
Done.
| |
| 16 HAS_SHELL = False | |
| 17 if platform.system() == 'Windows': | |
| 18 HAS_SHELL = True | |
| 19 GS_SITE = 'gs://dartlang-docgen' | |
| 20 | |
| 21 def ExecuteCommand(cmd): | |
|
Emily Fortuna
2013/07/10 21:23:32
isn't this function defined in the utils file? If
janicejl
2013/07/11 00:02:08
No it is not in the utils file, it is in upload_sd
| |
| 22 # Execute a command in a subprocess. | |
|
Emily Fortuna
2013/07/10 21:23:32
Doc comments for python are triple quotes """blah
janicejl
2013/07/11 00:02:08
Done.
| |
| 23 print 'Executing: ' + ' '.join(cmd) | |
| 24 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, | |
| 25 shell=HAS_SHELL) | |
| 26 output = pipe.communicate() | |
| 27 if pipe.returncode != 0: | |
| 28 print 'Execution failed: ' + str(output) | |
| 29 return (pipe.returncode, output) | |
| 30 | |
| 31 def main(argv): | |
|
Emily Fortuna
2013/07/10 21:23:32
no need to pass argument if it's not used.
def ma
janicejl
2013/07/11 00:02:08
Done.
| |
| 32 # Execute Docgen.dart on the SDK. | |
| 33 ExecuteCommand([DART, 'docgen.dart', '--include-private', '--parse-sdk']) | |
| 34 | |
| 35 # Use SVN Revision to get the revision number. | |
| 36 revision = utils.GetSVNRevision() | |
| 37 if revision is None: | |
| 38 sys.stderr.write('Unable to find revision. \n') | |
| 39 return 1 | |
|
Emily Fortuna
2013/07/10 21:23:32
throw exception here instead? No point in continui
janicejl
2013/07/11 00:02:08
Done.
| |
| 40 | |
| 41 # Upload the all files in Docs into a folder based off Revision number on | |
| 42 # Cloud Storage. | |
| 43 ExecuteCommand([GSUTIL, '-m', 'cp', '-q', '-a', 'public-read', '-r', | |
| 44 './docs/*', GS_SITE + '/' + revision + '/']) | |
| 45 | |
| 46 # Update VERSION file in Cloud Storage. | |
| 47 with open('VERSION', 'w') as version_file: | |
| 48 version_file.write(revision); | |
| 49 ExecuteCommand([GSUTIL, '-m', 'cp', '-q', '-a', 'public-read', './VERSION', | |
| 50 GS_SITE + '/VERSION']) | |
| 51 | |
| 52 if __name__ == '__main__': | |
| 53 sys.exit(main(sys.argv)) | |
|
Emily Fortuna
2013/07/10 21:23:32
it will automatically exit after calling main. Jus
janicejl
2013/07/11 00:02:08
Done.
| |
| OLD | NEW |