1#!/usr/bin/python2 2# 3# Copyright 2019 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_files.py: 8# This special action is used to cleanup old files from the build directory. 9# Otherwise ANGLE will pick up the old file(s), causing build or runtime errors. 10# 11 12import glob 13import os 14import sys 15 16if len(sys.argv) < 3: 17 print("Usage: " + sys.argv[0] + " <stamp_file> <remove_patterns>") 18 19stamp_file = sys.argv[1] 20 21for i in range(2, len(sys.argv)): 22 remove_pattern = sys.argv[i] 23 remove_files = glob.glob(remove_pattern) 24 for f in remove_files: 25 if os.path.isfile(f): 26 os.remove(f) 27 28# touch an unused file to keep a timestamp 29with open(stamp_file, "w") as f: 30 f.write("blah") 31 f.close() 32