diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-05 11:54:25 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-05 11:54:25 +0000 |
commit | f74163834803aa17f6a9da3a0b98242a11f659c6 (patch) | |
tree | 5468f05068e6cb2a649af935969d213e786f1836 /webkit/build | |
parent | 348364276fd771f7286df0958b1aa25a07ce474f (diff) | |
download | chromium_src-f74163834803aa17f6a9da3a0b98242a11f659c6.zip chromium_src-f74163834803aa17f6a9da3a0b98242a11f659c6.tar.gz chromium_src-f74163834803aa17f6a9da3a0b98242a11f659c6.tar.bz2 |
DevTools: auto-generate devtools.html from WebKit's inspector.html
BUG=21685
TEST=none
Review URL: http://codereview.chromium.org/243078
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27980 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/build')
-rwxr-xr-x | webkit/build/generate_devtools_html.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/webkit/build/generate_devtools_html.py b/webkit/build/generate_devtools_html.py new file mode 100755 index 0000000..5160fc2 --- /dev/null +++ b/webkit/build/generate_devtools_html.py @@ -0,0 +1,37 @@ +#!/usr/bin/env 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. + +import os.path +import sys + +def GenerateIncludeTag(resource_path): + (dir_name, file_name) = os.path.split(resource_path) + if (file_name.endswith('.js')): + return ' <script type="text/javascript" src="%s"></script>\n' % file_name + elif (file_name.endswith('.css')): + return ' <link rel="stylesheet" type="text/css" href="%s">\n' % file_name + else: + assert false + + +def main(argv): + + if len(argv) < 4: + print 'usage: %s inspector_html devtools_html css_and_js_files_list' % argv[0] + return 1 + + inspector_html = open(argv[1], 'r') + devtools_html = open(argv[2], 'w') + + for line in inspector_html: + if '</head>' in line: + devtools_html.write('\n <!-- The following lines are added to include DevTools resources -->\n') + for resource in argv[3:]: + devtools_html.write(GenerateIncludeTag(resource)) + devtools_html.write(' <!-- End of auto-added files list -->\n') + devtools_html.write(line) + +if __name__ == '__main__': + sys.exit(main(sys.argv)) |