| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 Google Inc. All rights reserved. | 2 # Copyright (c) 2011 Google Inc. 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 import sys | 6 import sys |
| 7 | 7 |
| 8 assert len(sys.argv) == 4, sys.argv | 8 assert len(sys.argv) == 4, sys.argv |
| 9 | 9 |
| 10 (in_file, c_file, h_file) = sys.argv[1:] | 10 (in_file, c_file, h_file) = sys.argv[1:] |
| 11 | 11 |
| 12 def write_file(filename, contents): | 12 def write_file(filename, contents): |
| 13 open(filename, 'wb').write(contents) | 13 open(filename, 'w').write(contents) |
| 14 | 14 |
| 15 write_file(c_file, open(in_file, 'rb').read()) | 15 write_file(c_file, open(in_file, 'r').read()) |
| 16 | 16 |
| 17 write_file(h_file, '#define NAME "%s"\n' % in_file) | 17 write_file(h_file, '#define NAME "%s"\n' % in_file) |
| 18 | 18 |
| 19 sys.exit(0) | 19 sys.exit(0) |
| OLD | NEW |