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

Unified 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, 10 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 | « webkit/build/action_maketokenizer.py ('k') | webkit/build/rule_binding.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/build/action_useragentstylesheets.py
===================================================================
--- webkit/build/action_useragentstylesheets.py (revision 0)
+++ webkit/build/action_useragentstylesheets.py (revision 0)
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# usage: action_useragentstylesheets.py OUTPUTS -- INPUTS
+#
+# Multiple OUTPUTS and INPUTS may be listed. The sections are separated by
+# -- arguments.
+#
+# OUTPUTS must contain two items, in order: a path to UserAgentStyleSheets.h
+# and a path to UserAgentStyleSheetsData.cpp.
+#
+# INPUTS must contain at least two items. The first item must be the path to
+# make-css-file-arrays.pl. The remaining items are paths to style sheets to
+# be fed to that script.
+
+
+import os
+import subprocess
+import sys
+
+
+def SplitArgsIntoSections(args):
+ sections = []
+ while len(args) > 0:
+ if not '--' in args:
+ # If there is no '--' left, everything remaining is an entire section.
+ dashes = len(args)
+ else:
+ dashes = args.index('--')
+
+ sections.append(args[:dashes])
+
+ # Next time through the loop, look at everything after this '--'.
+ if dashes + 1 == len(args):
+ # If the '--' is at the end of the list, we won't come back through the
+ # loop again. Add an empty section now corresponding to the nothingness
+ # following the final '--'.
+ args = []
+ sections.append(args)
+ else:
+ args = args[dashes + 1:]
+
+ return sections
+
+
+def main(args):
+ sections = SplitArgsIntoSections(args[1:])
+ assert len(sections) == 2
+ (outputs, inputs) = sections
+
+ assert len(outputs) == 2
+ output_h = outputs[0]
+ output_cpp = outputs[1]
+
+ make_css_file_arrays = inputs[0]
+ style_sheets = inputs[1:]
+
+ # Build up the command.
+ command = ['perl', make_css_file_arrays, output_h, output_cpp]
+ command.extend(style_sheets)
+
+ # Do it. check_call is new in 2.5, so simulate its behavior with call and
+ # assert.
+ return_code = subprocess.call(command)
+ assert return_code == 0
+
+ return return_code
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
Property changes on: webkit/build/action_useragentstylesheets.py
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
« 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