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

Unified Diff: pkg/docgen/bin/uploadsdk.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/bin/uploadsdk.py
diff --git a/pkg/docgen/bin/uploadsdk.py b/pkg/docgen/bin/uploadsdk.py
new file mode 100644
index 0000000000000000000000000000000000000000..f1537b0c9e2230ae98d82d3291e8f68a522ac5ca
--- /dev/null
+++ b/pkg/docgen/bin/uploadsdk.py
@@ -0,0 +1,64 @@
+#!/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.
+#
+# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+""" This file will run docgen.dart on the SDK libraries, and upload them to
+ Google Cloud Storage for the documentation viewer.
+"""
+
+import os
+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.
+import platform
+import subprocess
+import sys
+sys.path.append(os.path.abspath('../../../tools'))
+import utils
+from upload_sdk import ExecuteCommand
+
+
+DART = os.path.abspath('../../../%s/%s/dart-sdk/bin/dart'
+ % (utils.BUILD_ROOT[utils.GuessOS()],
+ utils.GetBuildConf('release', utils.GuessArchitecture())))
+GSUTIL = utils.GetBuildbotGSUtilPath()
+GS_SITE = 'gs://dartlang-docgen'
+
+
+def SetGsutil():
+ 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.
+ """ If not on buildbots, find gsutil relative to docgen. """
+ if not os.path.exists(GSUTIL):
+ GSUTIL = os.path.abspath('../../../third_party/gsutil/gsutil')
+
+
+def Upload(source, target):
+ """ Upload files to Google Storage. """
+ cmd = [GSUTIL, '-m', 'cp', '-q', '-a', 'public-read', '-r', source, target]
+ (status, output) = ExecuteCommand(cmd)
+ return status
+
+
+def main():
+ SetGsutil()
+
+ """ 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.
+ ExecuteCommand([DART, 'docgen.dart', '--include-private', '--parse-sdk'])
+
+ """Use SVN Revision to get the revision number. """
+ revision = utils.GetSVNRevision()
+ if revision is None:
+ raise Exception("Unable to find revision. ")
+
+ """ Upload the all files in Docs into a folder based off Revision number on
+ Cloud Storage. """
+ Upload('./docs/*', GS_SITE + '/' + revision + '/')
+
+ """ Update VERSION file in Cloud Storage. """
+ with open('VERSION', 'w') as version_file:
+ version_file.write(revision)
+ Upload('./VERSION', GS_SITE + '/VERSION')
+
+
+if __name__ == '__main__':
+ main()
« 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