Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 """ This file will run docgen.dart on the SDK libraries, and upload them to | 7 """ This file will run docgen.dart on the SDK libraries, and upload them to |
| 8 Google Cloud Storage for the documentation viewer. | 8 Google Cloud Storage for the documentation viewer. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 (status, output) = ExecuteCommand(cmd) | 60 (status, output) = ExecuteCommand(cmd) |
| 61 return status | 61 return status |
| 62 | 62 |
| 63 | 63 |
| 64 def main(): | 64 def main(): |
| 65 GetOptions() | 65 GetOptions() |
| 66 | 66 |
| 67 SetGsutil() | 67 SetGsutil() |
| 68 | 68 |
| 69 # Execute Docgen.dart on the SDK. | 69 # Execute Docgen.dart on the SDK. |
| 70 ExecuteCommand([DART, '--checked', '--package-root=' + PACKAGE_ROOT, | 70 ExecuteCommand(['sh', './generate_all_docs.sh']) |
| 71 abspath(join(dirname(__file__), 'docgen.dart')), | |
| 72 '--parse-sdk', '--json']) | |
| 73 | 71 |
| 74 # Use SVN Revision to get the revision number. | 72 # Use SVN Revision to get the revision number. |
| 75 revision = utils.GetSVNRevision() | 73 revision = utils.GetSVNRevision() |
| 76 if revision is None: | 74 if revision is None: |
| 77 # Try to find the version from the dart-sdk folder. | 75 # Try to find the version from the dart-sdk folder. |
| 78 revision_file_location = abspath(join(dirname(__file__), | 76 revision_file_location = abspath(join(dirname(__file__), |
| 79 '../../../%s/%s/dart-sdk/revision' % (utils.BUILD_ROOT[utils.GuessOS()], | 77 '../../../%s/%s/dart-sdk/revision' % (utils.BUILD_ROOT[utils.GuessOS()], |
| 80 utils.GetBuildConf('release', utils.GuessArchitecture())))) | 78 utils.GetBuildConf('release', utils.GuessArchitecture())))) |
| 81 with open(revision_file_location, 'r') as revision_file: | 79 with open(revision_file_location, 'r') as revision_file: |
| 82 revision = revision_file.readline(5) | 80 revision = revision_file.readline(5) |
| 83 revision_file.close() | 81 revision_file.close() |
| 84 | 82 |
| 85 if revision is None: | 83 if revision is None: |
| 86 raise Exception("Unable to find revision. ") | 84 raise Exception("Unable to find revision. ") |
| 87 | 85 |
| 88 # Upload the all files in Docs into a folder based off Revision number on | 86 # Upload the all files in Docs into a folder based off Revision number on |
| 89 # Cloud Storage. | 87 # Cloud Storage. |
| 90 Upload('./docs/*', GS_SITE + '/' + revision + '/') | 88 # TODO(alanknight): If we give it ./docs/* it fails to upload files in the |
| 89 # subdirectory, probably due to escaping. Work around it by changing dir. | |
| 90 # Better, generalize this to be less dependent on the working directory. | |
| 91 os.chdir('docs') | |
| 92 Upload('.', GS_SITE + '/' + revision + '/') | |
|
terry
2013/10/30 18:11:31
Would this work then you wouldn't have to chdir to
Alan Knight
2013/10/30 18:31:33
That works, but then uploads into a subdirectory c
| |
| 93 os.chdir('..') | |
| 91 | 94 |
| 92 # Update VERSION file in Cloud Storage. | 95 # Update VERSION file in Cloud Storage. |
| 93 with open('VERSION', 'w') as version_file: | 96 with open('VERSION', 'w') as version_file: |
| 94 version_file.write(revision) | 97 version_file.write(revision) |
| 95 version_file.close() | 98 version_file.close() |
| 96 Upload('./VERSION', GS_SITE + '/VERSION') | 99 Upload('./VERSION', GS_SITE + '/VERSION') |
| 97 | 100 |
| 98 # Clean up the files it creates. | 101 # Clean up the files it creates. |
| 99 ExecuteCommand(['rm', '-rf', './docs']) | 102 ExecuteCommand(['rm', '-rf', './docs']) |
| 100 ExecuteCommand(['rm', '-f', './VERSION']) | 103 ExecuteCommand(['rm', '-f', './VERSION']) |
| 101 | 104 |
| 102 | 105 |
| 103 if __name__ == '__main__': | 106 if __name__ == '__main__': |
| 104 main() | 107 main() |
| OLD | NEW |