Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | # Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | # Takes 3 arguments. Writes the 1st argument to the file in the 2nd argument, |
| 7 | # and writes the absolute path to the file in the 2nd argument to the file in |
| 8 | # the 3rd argument. |
| 9 | |
| 10 | import os |
| 11 | import shlex |
| 12 | import sys |
| 13 | |
| 14 | if len(sys.argv) == 3 and ' ' in sys.argv[2]: |
| 15 | sys.argv[2], fourth = shlex.split(sys.argv[2].replace('\\', '\\\\')) |
| 16 | sys.argv.append(fourth) |
| 17 | |
| 18 | #print >>sys.stderr, sys.argv |
| 19 | |
| 20 | with open(sys.argv[2], 'w') as f: |
| 21 | f.write(sys.argv[1]) |
| 22 | |
| 23 | with open(sys.argv[3], 'w') as f: |
| 24 | f.write(os.path.abspath(sys.argv[2])) |