| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 '''Class for reading GRD files into memory, without processing them. | 6 '''Class for reading GRD files into memory, without processing them. |
| 7 ''' | 7 ''' |
| 8 | 8 |
| 9 import os.path | 9 import os.path |
| 10 import types | 10 import types |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 assert isinstance(filename_or_stream, types.StringType) or dir != None | 140 assert isinstance(filename_or_stream, types.StringType) or dir != None |
| 141 if not dir: | 141 if not dir: |
| 142 dir = util.dirname(filename_or_stream) | 142 dir = util.dirname(filename_or_stream) |
| 143 if len(dir) == 0: | 143 if len(dir) == 0: |
| 144 dir = '.' | 144 dir = '.' |
| 145 # Fix up the base_dir so it is relative to the input file. | 145 # Fix up the base_dir so it is relative to the input file. |
| 146 handler.root.SetOwnDir(dir) | 146 handler.root.SetOwnDir(dir) |
| 147 | 147 |
| 148 # Assign first ids to the nodes that don't have them. | 148 # Assign first ids to the nodes that don't have them. |
| 149 if isinstance(handler.root, misc.GritNode) and first_id_filename != '': | 149 if isinstance(handler.root, misc.GritNode) and first_id_filename != '': |
| 150 handler.root.AssignFirstIds(filename_or_stream, first_id_filename) | 150 handler.root.AssignFirstIds(filename_or_stream, first_id_filename, defines) |
| 151 | 151 |
| 152 return handler.root | 152 return handler.root |
| 153 | 153 |
| 154 | 154 |
| 155 if __name__ == '__main__': | 155 if __name__ == '__main__': |
| 156 util.ChangeStdoutEncoding() | 156 util.ChangeStdoutEncoding() |
| 157 print unicode(Parse(sys.argv[1])) | 157 print unicode(Parse(sys.argv[1])) |
| OLD | NEW |