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

Side by Side Diff: client/tools/update.py

Issue 9837113: Move update.py to samples/swarm, remove a bunch of deprecated files for (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | « client/tools/sourcemap.py ('k') | samples/swarm/update.py » ('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/env python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file.
5
6 # This script builds and then uploads the Dart client sample app to AppEngine,
7 # where it is accessible by visiting http://dart.googleplex.com.
8 import os
9 import subprocess
10 import sys
11
12 from os.path import abspath, basename, dirname, exists, join, split, relpath
13 import base64, re, os, shutil, subprocess, sys, tempfile, optparse
14
15 APP_PATH = os.getcwd()
16 CLIENT_TOOLS_PATH = dirname(abspath(__file__))
17 CLIENT_PATH = dirname(CLIENT_TOOLS_PATH)
18
19 # Add the client tools directory so we can find htmlconverter.py.
20 sys.path.append(CLIENT_TOOLS_PATH)
21 import htmlconverter
22
23 def convertOne(infile, options):
24 outDirBase = 'outcode'
25 outfile = join(outDirBase, infile)
26 print 'converting %s to %s' % (infile, outfile)
27
28 if 'dart' in options.target:
29 htmlconverter.convertForDartium(
30 infile,
31 outDirBase,
32 outfile.replace('.html', '-dart.html'),
33 options.verbose)
34 if 'js' in options.target:
35 htmlconverter.convertForChromium(
36 infile, options.dartc_extra_flags,
37 outfile.replace('.html', '-js.html'),
38 options.verbose)
39
40
41 def Flags():
42 """ Consturcts a parser for extracting flags from the command line. """
43 result = optparse.OptionParser()
44 result.add_option("-t", "--target",
45 help="The target html to generate",
46 metavar="[js,dart]",
47 default='js,dart')
48 result.add_option("--verbose",
49 help="Print verbose output",
50 default=False,
51 action="store_true")
52 result.add_option("--dartc_extra_flags",
53 help="Additional flag text to pass to dartc",
54 default="",
55 action="store")
56 #result.set_usage("update.py input.html -o OUTDIR -t chromium,dartium")
57 return result
58
59 def getAllHtmlFiles():
60 htmlFiles = []
61 for filename in os.listdir(APP_PATH):
62 fName, fExt = os.path.splitext(filename)
63 if fExt.lower() == '.html':
64 htmlFiles.append(filename)
65
66 return htmlFiles
67
68 def main():
69 os.chdir(CLIENT_PATH) # TODO(jimhug): I don't like chdir's in scripts...
70
71 parser = Flags()
72 options, args = parser.parse_args()
73 #if len(args) < 1 or not options.out or not options.target:
74 # parser.print_help()
75 # return 1
76
77 REL_APP_PATH = relpath(APP_PATH)
78 for file in getAllHtmlFiles():
79 infile = join(REL_APP_PATH, file)
80 convertOne(infile, options)
81
82 if __name__ == '__main__':
83 main()
OLDNEW
« no previous file with comments | « client/tools/sourcemap.py ('k') | samples/swarm/update.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698