OLD | NEW |
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 '''Uses the closure compiler to check the braille ime.''' | 7 '''Uses the closure compiler to check the braille ime.''' |
8 | 8 |
9 import os | 9 import os |
10 import sys | 10 import sys |
11 | 11 |
12 | 12 |
13 _SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 13 _SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
14 | 14 |
15 sys.path.insert(0, os.path.join(_SCRIPT_DIR, '..', 'chromevox', 'tools')) | 15 sys.path.insert(0, os.path.join(_SCRIPT_DIR, '..', 'chromevox', 'tools')) |
16 from jscompilerwrapper import RunCompiler | 16 from jscompilerwrapper import RunCompiler |
17 | 17 |
18 | 18 |
| 19 _CHROME_SOURCE_DIR = os.path.normpath( |
| 20 os.path.join(_SCRIPT_DIR, *[os.path.pardir] * 5)) |
| 21 |
| 22 |
19 def CheckBrailleIme(): | 23 def CheckBrailleIme(): |
20 print 'Compiling braille IME.' | 24 print 'Compiling braille IME.' |
21 js_files = [ | 25 js_files = [ |
22 os.path.join(_SCRIPT_DIR, 'main.js'), | 26 os.path.join(_SCRIPT_DIR, 'braille_ime.js'), |
23 os.path.join(_SCRIPT_DIR, 'braille_ime.js')] | 27 os.path.join(_SCRIPT_DIR, 'main.js')] |
24 externs = [os.path.join(_SCRIPT_DIR, 'externs.js')] | 28 externs = [ |
| 29 os.path.join( |
| 30 _CHROME_SOURCE_DIR, |
| 31 'third_party/closure_compiler/externs/chrome_extensions.js'), |
| 32 os.path.join(_SCRIPT_DIR, 'externs.js')] |
25 return RunCompiler(js_files, externs) | 33 return RunCompiler(js_files, externs) |
26 | 34 |
27 | 35 |
28 def main(): | 36 def main(): |
29 success, output = CheckBrailleIme() | 37 success, output = CheckBrailleIme() |
30 if len(output) > 0: | 38 if len(output) > 0: |
31 print output | 39 print output |
32 return int(not success) | 40 return int(not success) |
33 | 41 |
34 | 42 |
35 if __name__ == '__main__': | 43 if __name__ == '__main__': |
36 sys.exit(main()) | 44 sys.exit(main()) |
OLD | NEW |