Jamie Madill | 8a57b46 | 2017-12-28 12:25:03 -0500 | [diff] [blame^] | 1 | #!/usr/bin/python2 |
| 2 | # |
| 3 | # Copyright 2017 The ANGLE Project Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | # |
| 7 | # remove_file_if_exists.py: |
| 8 | # This special action is needed to remove generated headers. |
| 9 | # Otherwise ANGLE will pick up the old file(s) and the build will fail. |
| 10 | # |
| 11 | |
| 12 | import sys |
| 13 | import os |
| 14 | |
| 15 | if len(sys.argv) < 3: |
| 16 | print("Usage: " + sys.argv[0] + " <remove_file> <stamp_file>") |
| 17 | |
| 18 | remove_file = sys.argv[1] |
| 19 | if os.path.isfile(remove_file): |
| 20 | os.remove(remove_file) |
| 21 | |
| 22 | # touch a dummy file to keep a timestamp |
| 23 | with open(sys.argv[2], "w") as f: |
| 24 | f.write("blah") |
| 25 | f.close() |