1*c8dee2aaSAndroid Build Coastguard Worker#!/usr/bin/env python 2*c8dee2aaSAndroid Build Coastguard Worker# 3*c8dee2aaSAndroid Build Coastguard Worker# Copyright 2016 Google Inc. 4*c8dee2aaSAndroid Build Coastguard Worker# 5*c8dee2aaSAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be 6*c8dee2aaSAndroid Build Coastguard Worker# found in the LICENSE file. 7*c8dee2aaSAndroid Build Coastguard Worker 8*c8dee2aaSAndroid Build Coastguard Workerimport os 9*c8dee2aaSAndroid Build Coastguard Workerimport shutil 10*c8dee2aaSAndroid Build Coastguard Workerimport sys 11*c8dee2aaSAndroid Build Coastguard Worker 12*c8dee2aaSAndroid Build Coastguard Workersrc, dst = sys.argv[1:] 13*c8dee2aaSAndroid Build Coastguard Worker 14*c8dee2aaSAndroid Build Coastguard Workerif os.path.exists(dst): 15*c8dee2aaSAndroid Build Coastguard Worker if os.path.isdir(dst): 16*c8dee2aaSAndroid Build Coastguard Worker shutil.rmtree(dst) 17*c8dee2aaSAndroid Build Coastguard Worker else: 18*c8dee2aaSAndroid Build Coastguard Worker os.remove(dst) 19*c8dee2aaSAndroid Build Coastguard Worker 20*c8dee2aaSAndroid Build Coastguard Workerif os.path.isdir(src): 21*c8dee2aaSAndroid Build Coastguard Worker shutil.copytree(src, dst) 22*c8dee2aaSAndroid Build Coastguard Workerelse: 23*c8dee2aaSAndroid Build Coastguard Worker shutil.copy2(src, dst) 24*c8dee2aaSAndroid Build Coastguard Worker #work around https://github.com/ninja-build/ninja/issues/1554 25*c8dee2aaSAndroid Build Coastguard Worker os.utime(dst, None) 26