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

Side by Side Diff: webkit/build/action_useragentstylesheets.py

Issue 27158: Import .gyp files into the Chromium tree (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 11 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
« no previous file with comments | « webkit/build/action_maketokenizer.py ('k') | webkit/build/rule_binding.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # usage: action_useragentstylesheets.py OUTPUTS -- INPUTS
8 #
9 # Multiple OUTPUTS and INPUTS may be listed. The sections are separated by
10 # -- arguments.
11 #
12 # OUTPUTS must contain two items, in order: a path to UserAgentStyleSheets.h
13 # and a path to UserAgentStyleSheetsData.cpp.
14 #
15 # INPUTS must contain at least two items. The first item must be the path to
16 # make-css-file-arrays.pl. The remaining items are paths to style sheets to
17 # be fed to that script.
18
19
20 import os
21 import subprocess
22 import sys
23
24
25 def SplitArgsIntoSections(args):
26 sections = []
27 while len(args) > 0:
28 if not '--' in args:
29 # If there is no '--' left, everything remaining is an entire section.
30 dashes = len(args)
31 else:
32 dashes = args.index('--')
33
34 sections.append(args[:dashes])
35
36 # Next time through the loop, look at everything after this '--'.
37 if dashes + 1 == len(args):
38 # If the '--' is at the end of the list, we won't come back through the
39 # loop again. Add an empty section now corresponding to the nothingness
40 # following the final '--'.
41 args = []
42 sections.append(args)
43 else:
44 args = args[dashes + 1:]
45
46 return sections
47
48
49 def main(args):
50 sections = SplitArgsIntoSections(args[1:])
51 assert len(sections) == 2
52 (outputs, inputs) = sections
53
54 assert len(outputs) == 2
55 output_h = outputs[0]
56 output_cpp = outputs[1]
57
58 make_css_file_arrays = inputs[0]
59 style_sheets = inputs[1:]
60
61 # Build up the command.
62 command = ['perl', make_css_file_arrays, output_h, output_cpp]
63 command.extend(style_sheets)
64
65 # Do it. check_call is new in 2.5, so simulate its behavior with call and
66 # assert.
67 return_code = subprocess.call(command)
68 assert return_code == 0
69
70 return return_code
71
72
73 if __name__ == '__main__':
74 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « webkit/build/action_maketokenizer.py ('k') | webkit/build/rule_binding.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698