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

Side by Side Diff: chrome/common/extensions/docs/build/build.py

Issue 343052: Improve error messages in extensions/docs/build.py . (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Docbuilder for extension docs.""" 6 """Docbuilder for extension docs."""
7 7
8 import os 8 import os
9 import os.path 9 import os.path
10 import shutil 10 import shutil
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 for loc in search_locations: 123 for loc in search_locations:
124 if os.path.isfile(loc): 124 if os.path.isfile(loc):
125 return loc 125 return loc
126 126
127 raise Exception ("Could not find test_shell executable\n" + 127 raise Exception ("Could not find test_shell executable\n" +
128 "**test_shell may need to be built**\n" + 128 "**test_shell may need to be built**\n" +
129 "Searched: \n" + "\n".join(search_locations) + "\n" + 129 "Searched: \n" + "\n".join(search_locations) + "\n" +
130 "To specify a path to test_shell use --test-shell-path") 130 "To specify a path to test_shell use --test-shell-path")
131 131
132 def GetAPIModuleNames(): 132 def GetAPIModuleNames():
133 contents = open(_extension_api_json, 'r').read(); 133 try:
134 extension_api = json.loads(contents, encoding="ASCII") 134 contents = open(_extension_api_json, 'r').read()
135 return set( module['namespace'].encode() for module in extension_api) 135 except IOError, msg:
136 raise Exception("Failed to read the file that defines the extensions API. "
137 "The specific error was: %s." % msg)
138
139 try:
140 extension_api = json.loads(contents, encoding="ASCII")
141 except ValueError, msg:
142 raise Exception("File %s has a syntax error: %s" %
143 (_extension_api_json, msg))
144
145 return set(module['namespace'].encode() for module in extension_api)
136 146
137 def GetStaticFileNames(): 147 def GetStaticFileNames():
138 static_files = os.listdir(_static_dir) 148 static_files = os.listdir(_static_dir)
139 return set(os.path.splitext(file)[0] 149 return set(os.path.splitext(file)[0]
140 for file in static_files 150 for file in static_files
141 if file.endswith(".html")) 151 if file.endswith(".html"))
142 152
143 def main(): 153 def main():
144 parser = OptionParser() 154 parser = OptionParser()
145 parser.add_option("--test-shell-path", dest="test_shell_path") 155 parser.add_option("--test-shell-path", dest="test_shell_path")
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 # and the os.remove will fail with a "Permission denied". 189 # and the os.remove will fail with a "Permission denied".
180 time.sleep(1); 190 time.sleep(1);
181 debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); 191 debug_log = os.path.normpath(_build_dir + "/" + "debug.log");
182 if (os.path.isfile(debug_log)): 192 if (os.path.isfile(debug_log)):
183 os.remove(debug_log) 193 os.remove(debug_log)
184 194
185 return 0; 195 return 0;
186 196
187 if __name__ == '__main__': 197 if __name__ == '__main__':
188 sys.exit(main()) 198 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698