xref: /aosp_15_r20/external/libchrome/build/cp.py (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1*635a8641SAndroid Build Coastguard Worker#!/usr/bin/env python
2*635a8641SAndroid Build Coastguard Worker# Copyright (c) 2012 The Chromium Authors. All rights reserved.
3*635a8641SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
4*635a8641SAndroid Build Coastguard Worker# found in the LICENSE file.
5*635a8641SAndroid Build Coastguard Worker
6*635a8641SAndroid Build Coastguard Worker"""Copy a file.
7*635a8641SAndroid Build Coastguard Worker
8*635a8641SAndroid Build Coastguard WorkerThis module works much like the cp posix command - it takes 2 arguments:
9*635a8641SAndroid Build Coastguard Worker(src, dst) and copies the file with path |src| to |dst|.
10*635a8641SAndroid Build Coastguard Worker"""
11*635a8641SAndroid Build Coastguard Worker
12*635a8641SAndroid Build Coastguard Workerimport os
13*635a8641SAndroid Build Coastguard Workerimport shutil
14*635a8641SAndroid Build Coastguard Workerimport sys
15*635a8641SAndroid Build Coastguard Worker
16*635a8641SAndroid Build Coastguard Worker
17*635a8641SAndroid Build Coastguard Workerdef Main(src, dst):
18*635a8641SAndroid Build Coastguard Worker  # Use copy instead of copyfile to ensure the executable bit is copied.
19*635a8641SAndroid Build Coastguard Worker  return shutil.copy(src, os.path.normpath(dst))
20*635a8641SAndroid Build Coastguard Worker
21*635a8641SAndroid Build Coastguard Worker
22*635a8641SAndroid Build Coastguard Workerif __name__ == '__main__':
23*635a8641SAndroid Build Coastguard Worker  sys.exit(Main(sys.argv[1], sys.argv[2]))
24