summaryrefslogtreecommitdiffstats
path: root/mojo/public/tools/prepend.py
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/public/tools/prepend.py')
-rwxr-xr-xmojo/public/tools/prepend.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/mojo/public/tools/prepend.py b/mojo/public/tools/prepend.py
deleted file mode 100755
index de70a82..0000000
--- a/mojo/public/tools/prepend.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""
-Prepends a given file with a given line. This can be used to add a shebang line
-to a generated file.
-"""
-
-import optparse
-import os
-import shutil
-import sys
-
-
-def main():
- parser = optparse.OptionParser()
- parser.add_option('--input', help='The file to prepend the line to.')
- parser.add_option('--line', help='The line to be prepended.')
- parser.add_option('--output', help='The output file.')
-
- options, _ = parser.parse_args()
- input_path = options.input
- output_path = options.output
- line = options.line
-
- # Warning - this reads all of the input file into memory.
- with open(output_path, 'w') as output_file:
- output_file.write(line + '\n')
- with open(input_path, 'r') as input_file:
- shutil.copyfileobj(input_file, output_file)
-
-
-if __name__ == '__main__':
- sys.exit(main())