Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
|
Emily Fortuna
2013/07/11 18:40:37
nit: can we call this file something like upload_d
janicejl
2013/07/11 20:44:28
Done.
| |
| 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 """ This file will run docgen.dart on the SDK libraries, and upload them to | |
| 8 Google Cloud Storage for the documentation viewer. | |
| 9 """ | |
| 10 | |
| 11 import os | |
| 12 import os.path | |
|
Emily Fortuna
2013/07/11 18:40:37
this line is unnecessary. since you already import
janicejl
2013/07/11 20:44:28
Done.
| |
| 13 import platform | |
| 14 import subprocess | |
| 15 import sys | |
| 16 sys.path.append(os.path.abspath('../../../tools')) | |
| 17 import utils | |
| 18 from upload_sdk import ExecuteCommand | |
| 19 | |
| 20 | |
| 21 DART = os.path.abspath('../../../%s/%s/dart-sdk/bin/dart' | |
| 22 % (utils.BUILD_ROOT[utils.GuessOS()], | |
| 23 utils.GetBuildConf('release', utils.GuessArchitecture()))) | |
| 24 GSUTIL = utils.GetBuildbotGSUtilPath() | |
| 25 GS_SITE = 'gs://dartlang-docgen' | |
| 26 | |
| 27 | |
| 28 def SetGsutil(): | |
| 29 global GSUTIL | |
|
Emily Fortuna
2013/07/11 18:40:37
I'd but the global declaration below the doc comme
janicejl
2013/07/11 20:44:28
Done.
| |
| 30 """ If not on buildbots, find gsutil relative to docgen. """ | |
| 31 if not os.path.exists(GSUTIL): | |
| 32 GSUTIL = os.path.abspath('../../../third_party/gsutil/gsutil') | |
| 33 | |
| 34 | |
| 35 def Upload(source, target): | |
| 36 """ Upload files to Google Storage. """ | |
| 37 cmd = [GSUTIL, '-m', 'cp', '-q', '-a', 'public-read', '-r', source, target] | |
| 38 (status, output) = ExecuteCommand(cmd) | |
| 39 return status | |
| 40 | |
| 41 | |
| 42 def main(): | |
| 43 SetGsutil() | |
| 44 | |
| 45 """ Execute Docgen.dart on the SDK. """ | |
|
Emily Fortuna
2013/07/11 18:40:37
For just regular line comments, use the #. the tri
janicejl
2013/07/11 20:44:28
Done.
| |
| 46 ExecuteCommand([DART, 'docgen.dart', '--include-private', '--parse-sdk']) | |
| 47 | |
| 48 """Use SVN Revision to get the revision number. """ | |
| 49 revision = utils.GetSVNRevision() | |
| 50 if revision is None: | |
| 51 raise Exception("Unable to find revision. ") | |
| 52 | |
| 53 """ Upload the all files in Docs into a folder based off Revision number on | |
| 54 Cloud Storage. """ | |
| 55 Upload('./docs/*', GS_SITE + '/' + revision + '/') | |
| 56 | |
| 57 """ Update VERSION file in Cloud Storage. """ | |
| 58 with open('VERSION', 'w') as version_file: | |
| 59 version_file.write(revision) | |
| 60 Upload('./VERSION', GS_SITE + '/VERSION') | |
| 61 | |
| 62 | |
| 63 if __name__ == '__main__': | |
| 64 main() | |
| OLD | NEW |