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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/tools/generate_deps.py

Issue 600333002: Fix the ChromeVox generate_deps.py to create the parent dir for the output file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « 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')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 ''' Generates a deps.js file based on an input list of javascript files using 7 ''' Generates a deps.js file based on an input list of javascript files using
8 Closure style provide/require calls. 8 Closure style provide/require calls.
9 ''' 9 '''
10 10
(...skipping 24 matching lines...) Expand all
35 'The resulting path is used in the deps mapping ' + 35 'The resulting path is used in the deps mapping ' +
36 'file path to a list of provided and required ' + 36 'file path to a list of provided and required ' +
37 'namespaces.')) 37 'namespaces.'))
38 parser.add_option('-o', '--output_file', action='store', default=[], 38 parser.add_option('-o', '--output_file', action='store', default=[],
39 metavar='SPEC', 39 metavar='SPEC',
40 help=('Where to output the generated deps file.')) 40 help=('Where to output the generated deps file.'))
41 options, args = parser.parse_args() 41 options, args = parser.parse_args()
42 42
43 path_rewriter = PathRewriter(options.prefix_map) 43 path_rewriter = PathRewriter(options.prefix_map)
44 44
45 # Create the generated deps file's parent directory.
46 output_dir = os.path.dirname(os.path.abspath(options.output_file))
47 if not os.path.exists(output_dir):
48 os.makedirs(output_dir)
49
45 # Write the generated deps file. 50 # Write the generated deps file.
46 with open(options.output_file, 'w') as output: 51 with open(options.output_file, 'w') as output:
47 for path in args: 52 for path in args:
48 js_deps = source.Source(source.GetFileContents(path)) 53 js_deps = source.Source(source.GetFileContents(path))
49 path = path_rewriter.RewritePath(path) 54 path = path_rewriter.RewritePath(path)
50 line = 'goog.addDependency(\'%s\', %s, %s);\n' % ( 55 line = 'goog.addDependency(\'%s\', %s, %s);\n' % (
51 path, sorted(js_deps.provides), sorted(js_deps.requires)) 56 path, sorted(js_deps.provides), sorted(js_deps.requires))
52 output.write(line) 57 output.write(line)
53 58
54 59
55 if __name__ == '__main__': 60 if __name__ == '__main__':
56 main() 61 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