OLD | NEW |
---|---|
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os.path | 5 import os.path |
6 import sys | 6 import sys |
7 import optparse | 7 import optparse |
8 try: | 8 try: |
9 import json | 9 import json |
10 except ImportError: | 10 except ImportError: |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 # In Blink, jinja2 is in chromium's third_party directory. | 24 # In Blink, jinja2 is in chromium's third_party directory. |
25 # Insert at 1 so at front to override system libraries, and | 25 # Insert at 1 so at front to override system libraries, and |
26 # after path[0] == invoking script dir | 26 # after path[0] == invoking script dir |
27 third_party_dir = os.path.normpath(os.path.join( | 27 third_party_dir = os.path.normpath(os.path.join( |
28 module_path, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, | 28 module_path, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, |
29 "third_party")) | 29 "third_party")) |
30 if os.path.isdir(third_party_dir): | 30 if os.path.isdir(third_party_dir): |
31 sys.path.insert(1, third_party_dir) | 31 sys.path.insert(1, third_party_dir) |
32 | 32 |
33 # In V8, it is in tools folder | |
34 tools_dir = os.path.normpath(os.path.join( | |
35 module_path, os.pardir, os.pardir, "tools")) | |
pfeldman
2016/07/22 17:07:34
I don't think we are allowed to have third party o
| |
36 | |
37 if os.path.isdir(tools_dir): | |
38 sys.path.insert(1, tools_dir) | |
39 | |
33 # In Node, it is in deps folder | 40 # In Node, it is in deps folder |
34 deps_dir = os.path.normpath(os.path.join( | 41 deps_dir = os.path.normpath(os.path.join( |
35 module_path, os.pardir, os.pardir, os.pardir, os.pardir, "third_party")) | 42 module_path, os.pardir, os.pardir, os.pardir, os.pardir, "third_party")) |
36 | 43 |
37 if os.path.isdir(deps_dir): | 44 if os.path.isdir(deps_dir): |
38 sys.path.insert(1, os.path.join(deps_dir, "jinja2")) | 45 sys.path.insert(1, os.path.join(deps_dir, "jinja2")) |
39 sys.path.insert(1, os.path.join(deps_dir, "markupsafe")) | 46 sys.path.insert(1, os.path.join(deps_dir, "markupsafe")) |
40 | 47 |
41 import jinja2 | 48 import jinja2 |
42 | 49 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 cpp_file = output_file(cpp_file_name) | 355 cpp_file = output_file(cpp_file_name) |
349 h_file.write(h_template.render(template_context)) | 356 h_file.write(h_template.render(template_context)) |
350 cpp_file.write(cpp_template.render(template_context)) | 357 cpp_file.write(cpp_template.render(template_context)) |
351 h_file.close() | 358 h_file.close() |
352 cpp_file.close() | 359 cpp_file.close() |
353 | 360 |
354 | 361 |
355 for domain in json_api["domains"]: | 362 for domain in json_api["domains"]: |
356 if domain["domain"] in generate_domains: | 363 if domain["domain"] in generate_domains: |
357 generate(domain) | 364 generate(domain) |
OLD | NEW |