Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: pkg/docgen/bin/upload_docgen.py

Issue 18999006: Added a uploadsdk python script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/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 """ 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 from os.path import join, dirname, abspath, exists
13 import platform
14 import subprocess
15 import sys
16 sys.path.append(abspath(join(dirname(__file__), '../../../tools')))
17 import utils
18 from upload_sdk import ExecuteCommand
19
20
21 DART = abspath(join(dirname(__file__), '../../../%s/%s/dart-sdk/bin/dart'
22 % (utils.BUILD_ROOT[utils.GuessOS()], utils.GetBuildConf('release',
23 utils.GuessArchitecture()))))
24 GSUTIL = utils.GetBuildbotGSUtilPath()
25 GS_SITE = 'gs://dartlang-docgen'
26
27
28 def SetGsutil():
29 """ If not on buildbots, find gsutil relative to docgen. """
30 global GSUTIL
31 if not exists(GSUTIL):
32 GSUTIL = abspath(join(dirname(__file__),
33 '../../../third_party/gsutil/gsutil'))
34
35
36 def Upload(source, target):
37 """ Upload files to Google Storage. """
38 cmd = [GSUTIL, '-m', 'cp', '-q', '-a', 'public-read', '-r', source, target]
39 (status, output) = ExecuteCommand(cmd)
40 return status
41
42
43 def main():
44 SetGsutil()
45
46 # Execute Docgen.dart on the SDK.
47 ExecuteCommand([DART, abspath(join(dirname(__file__), 'docgen.dart')),
48 '--parse-sdk'])
49
50 # Use SVN Revision to get the revision number.
51 revision = utils.GetSVNRevision()
52 if revision is None:
53 # Try to find the version from the dart-sdk folder.
54 revision_file_location = abspath(join(dirname(__file__),
55 '../../../%s/%s/dart-sdk/revision' % (utils.BUILD_ROOT[utils.GuessOS()],
56 utils.GetBuildConf('release', utils.GuessArchitecture()))))
57 with open(revision_file_location, 'r') as revision_file:
58 revision = revision_file.readline(5)
59 revision_file.close()
60
61 if revision is None:
62 raise Exception("Unable to find revision. ")
63
64 # Upload the all files in Docs into a folder based off Revision number on
65 # Cloud Storage.
66 Upload('./docs/*', GS_SITE + '/' + revision + '/')
67
68 # Update VERSION file in Cloud Storage.
69 with open('VERSION', 'w') as version_file:
70 version_file.write(revision)
71 version_file.close()
72 Upload('./VERSION', GS_SITE + '/VERSION')
73
74 # Clean up the files it creates.
75 ExecuteCommand(['rm', '-rf', './docs'])
76 ExecuteCommand(['rm', '-f', './VERSION'])
77
78
79 if __name__ == '__main__':
80 main()
OLDNEW
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698