| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 import os | 29 import os |
| 30 import os.path | 30 import os.path |
| 31 import shlex | 31 import shlex |
| 32 import shutil | 32 import shutil |
| 33 import optparse | 33 import optparse |
| 34 | 34 |
| 35 from in_file import InFile | 35 from in_file import InFile |
| 36 | 36 |
| 37 | 37 |
| 38 ######################################################### |
| 39 # This is now deprecated - use json5_generator.py instead |
| 40 ######################################################### |
| 38 class GenericWriter(object): | 41 class GenericWriter(object): |
| 39 def __init__(self, in_files): | 42 def __init__(self, in_files): |
| 40 self._outputs = {} # file_name -> generator | 43 self._outputs = {} # file_name -> generator |
| 41 | 44 |
| 42 def _write_file_if_changed(self, output_dir, contents, file_name): | 45 def _write_file_if_changed(self, output_dir, contents, file_name): |
| 43 path = os.path.join(output_dir, file_name) | 46 path = os.path.join(output_dir, file_name) |
| 44 | 47 |
| 45 # The build system should ensure our output directory exists, but just i
n case. | 48 # The build system should ensure our output directory exists, but just i
n case. |
| 46 directory = os.path.dirname(path) | 49 directory = os.path.dirname(path) |
| 47 if not os.path.exists(directory): | 50 if not os.path.exists(directory): |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 help='Path to Xcode.') | 102 help='Path to Xcode.') |
| 100 parser.add_option("--output_dir", default=os.getcwd()) | 103 parser.add_option("--output_dir", default=os.getcwd()) |
| 101 options, args = parser.parse_args() | 104 options, args = parser.parse_args() |
| 102 | 105 |
| 103 if options.developer_dir: | 106 if options.developer_dir: |
| 104 os.environ['DEVELOPER_DIR'] = options.developer_dir | 107 os.environ['DEVELOPER_DIR'] = options.developer_dir |
| 105 | 108 |
| 106 writer = self._writer_class(args) | 109 writer = self._writer_class(args) |
| 107 writer.set_gperf_path(options.gperf) | 110 writer.set_gperf_path(options.gperf) |
| 108 writer.write_files(options.output_dir) | 111 writer.write_files(options.output_dir) |
| OLD | NEW |