OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 # pylint: disable=W0104,W0106,F0401,R0201 | 6 # pylint: disable=W0104,W0106,F0401,R0201 |
7 | 7 |
8 import errno | 8 import errno |
9 import optparse | 9 import optparse |
10 import os.path | 10 import os.path |
(...skipping 11 matching lines...) Expand all Loading... |
22 also be "above" this file).""" | 22 also be "above" this file).""" |
23 path = _ScriptDir() | 23 path = _ScriptDir() |
24 while True: | 24 while True: |
25 path, tail = os.path.split(path) | 25 path, tail = os.path.split(path) |
26 assert tail | 26 assert tail |
27 if tail == dirname: | 27 if tail == dirname: |
28 return path | 28 return path |
29 | 29 |
30 | 30 |
31 def _AddThirdPartyImportPath(): | 31 def _AddThirdPartyImportPath(): |
32 sys.path.append(os.path.join(_GetDirAbove('mojo'), 'third_party')) | 32 sys.path.insert(0, os.path.join(_GetDirAbove('mojo'), 'third_party')) |
33 | 33 |
34 | 34 |
35 _AddThirdPartyImportPath() | 35 _AddThirdPartyImportPath() |
36 import jinja2 | 36 import jinja2 |
37 | 37 |
38 loader = jinja2.FileSystemLoader(_ScriptDir()) | 38 loader = jinja2.FileSystemLoader(_ScriptDir()) |
39 jinja_env = jinja2.Environment(loader=loader, keep_trailing_newline=True) | 39 jinja_env = jinja2.Environment(loader=loader, keep_trailing_newline=True) |
40 | 40 |
41 | 41 |
42 # Accumulate lines of code with varying levels of indentation. | 42 # Accumulate lines of code with varying levels of indentation. |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 GenerateMojoSyscall(mojo.functions, out) | 498 GenerateMojoSyscall(mojo.functions, out) |
499 | 499 |
500 out = OutFile(options.out_dir, 'mojo_irt.h') | 500 out = OutFile(options.out_dir, 'mojo_irt.h') |
501 GenerateMojoIrtHeader(mojo.functions, out) | 501 GenerateMojoIrtHeader(mojo.functions, out) |
502 | 502 |
503 out = OutFile(options.out_dir, 'mojo_irt.c') | 503 out = OutFile(options.out_dir, 'mojo_irt.c') |
504 GenerateMojoIrtImplementation(mojo.functions, out) | 504 GenerateMojoIrtImplementation(mojo.functions, out) |
505 | 505 |
506 if __name__ == '__main__': | 506 if __name__ == '__main__': |
507 main(sys.argv[1:]) | 507 main(sys.argv[1:]) |
OLD | NEW |