OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 Prepends a given file with a given line. This can be used to add a shebang line | 8 Prepends a given file with a given line. This can be used to add a shebang line |
9 to a generated file. | 9 to a generated file. |
10 """ | 10 """ |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 # Warning - this reads all of the input file into memory. | 29 # Warning - this reads all of the input file into memory. |
30 with open(output_path, 'w') as output_file: | 30 with open(output_path, 'w') as output_file: |
31 output_file.write(line + '\n') | 31 output_file.write(line + '\n') |
32 with open(input_path, 'r') as input_file: | 32 with open(input_path, 'r') as input_file: |
33 shutil.copyfileobj(input_file, output_file) | 33 shutil.copyfileobj(input_file, output_file) |
34 | 34 |
35 | 35 |
36 if __name__ == '__main__': | 36 if __name__ == '__main__': |
37 sys.exit(main()) | 37 sys.exit(main()) |
OLD | NEW |