| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 # Path handling for libraries and templates | 55 # Path handling for libraries and templates |
| 56 # Paths have to be normalized because Jinja uses the exact template path to | 56 # Paths have to be normalized because Jinja uses the exact template path to |
| 57 # determine the hash used in the cache filename, and we need a pre-caching step | 57 # determine the hash used in the cache filename, and we need a pre-caching step |
| 58 # to be concurrency-safe. Use absolute path because __file__ is absolute if | 58 # to be concurrency-safe. Use absolute path because __file__ is absolute if |
| 59 # module is imported, and relative if executed directly. | 59 # module is imported, and relative if executed directly. |
| 60 # If paths differ between pre-caching and individual file compilation, the cache | 60 # If paths differ between pre-caching and individual file compilation, the cache |
| 61 # is regenerated, which causes a race condition and breaks concurrent build, | 61 # is regenerated, which causes a race condition and breaks concurrent build, |
| 62 # since some compile processes will try to read the partially written cache. | 62 # since some compile processes will try to read the partially written cache. |
| 63 module_path = os.path.dirname(os.path.realpath(__file__)) | 63 module_path = os.path.dirname(os.path.realpath(__file__)) |
| 64 third_party_dir = os.path.normpath(os.path.join( | 64 third_party_dir = os.path.normpath(os.path.join( |
| 65 module_path, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir)) | 65 module_path, os.pardir, os.pardir, os.pardir, os.pardir)) |
| 66 templates_dir = os.path.normpath(os.path.join( | 66 templates_dir = os.path.normpath(os.path.join( |
| 67 module_path, os.pardir, os.pardir, 'templates')) | 67 module_path, os.pardir, 'templates')) |
| 68 | 68 |
| 69 # jinja2 is in chromium's third_party directory. | 69 # jinja2 is in chromium's third_party directory. |
| 70 # Insert at 1 so at front to override system libraries, and | 70 # Insert at 1 so at front to override system libraries, and |
| 71 # after path[0] == invoking script dir | 71 # after path[0] == invoking script dir |
| 72 sys.path.insert(1, third_party_dir) | 72 sys.path.insert(1, third_party_dir) |
| 73 import jinja2 | 73 import jinja2 |
| 74 | 74 |
| 75 import v8_callback_interface | 75 import v8_callback_interface |
| 76 from v8_globals import includes, interfaces | 76 from v8_globals import includes, interfaces |
| 77 import v8_interface | 77 import v8_interface |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 # Create a dummy file as output for the build system, | 206 # Create a dummy file as output for the build system, |
| 207 # since filenames of individual cache files are unpredictable and opaque | 207 # since filenames of individual cache files are unpredictable and opaque |
| 208 # (they are hashes of the template path, which varies based on environment) | 208 # (they are hashes of the template path, which varies based on environment) |
| 209 with open(dummy_filename, 'w') as dummy_file: | 209 with open(dummy_filename, 'w') as dummy_file: |
| 210 pass # |open| creates or touches the file | 210 pass # |open| creates or touches the file |
| 211 | 211 |
| 212 | 212 |
| 213 if __name__ == '__main__': | 213 if __name__ == '__main__': |
| 214 sys.exit(main(sys.argv)) | 214 sys.exit(main(sys.argv)) |
| OLD | NEW |