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

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 import platform
13 import subprocess
14 import sys
15 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
Emily Fortuna 2013/07/11 22:41:24 here's a little trick that will make these lines l
janicejl 2013/07/11 22:53:11 Done.
16 '../../../tools')))
17 import utils
18 from upload_sdk import ExecuteCommand
19
20
21 DART = os.path.abspath(os.path.join(os.path.dirname(__file__),
22 '../../../%s/%s/dart-sdk/bin/dart' % (utils.BUILD_ROOT[utils.GuessOS()],
23 utils.GetBuildConf('release', utils.GuessArchitecture()))))
24 GSUTIL = utils.GetBuildbotGSUtilPath()
25 GS_SITE = 'gs://dartlang-docgen'
26 print DART
Emily Fortuna 2013/07/11 22:41:24 debug code?
janicejl 2013/07/11 22:53:11 Done.
27
28 def SetGsutil():
29 """ If not on buildbots, find gsutil relative to docgen. """
30 global GSUTIL
31 if not os.path.exists(GSUTIL):
32 GSUTIL = os.path.abspath(os.path.join(os.path.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, os.path.abspath(os.path.join(os.path.dirname(__file__),
48 'docgen.dart')), '--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 = os.path.abspath(os.path.join(
55 os.path.dirname(__file__), '../../../%s/%s/dart-sdk/revision'
56 % (utils.BUILD_ROOT[utils.GuessOS()], utils.GetBuildConf('release',
57 utils.GuessArchitecture()))))
58 with open(revision_file_location, 'r') as revision_file:
59 revision = revision_file.readline(5)
60 revision_file.close()
61
62 if revision is None:
63 raise Exception("Unable to find revision. ")
64
65 # Upload the all files in Docs into a folder based off Revision number on
66 # Cloud Storage.
67 Upload('./docs/*', GS_SITE + '/' + revision + '/')
68
69 # Update VERSION file in Cloud Storage.
70 with open('VERSION', 'w') as version_file:
71 version_file.write(revision)
72 version_file.close()
73 Upload('./VERSION', GS_SITE + '/VERSION')
74
75 # Clean up the files it creates.
76 ExecuteCommand(['rm', '-rf', './docs'])
77 ExecuteCommand(['rm', '-f', './VERSION'])
78
79
80 if __name__ == '__main__':
81 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