summaryrefslogtreecommitdiffstats
path: root/scripts/cp-noerror
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-10-05 15:09:02 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-10-18 11:13:46 (GMT)
commite8338b7b143a451be7dc56c9acef7e5dbf2220b8 (patch)
treeba7470f60bf7544e7379fb4ca299160ec4cb96d9 /scripts/cp-noerror
parent25e060dde108a3d534be78f84a481ae7aeaec915 (diff)
downloadpoky-e8338b7b143a451be7dc56c9acef7e5dbf2220b8.tar.gz
scripts/cp-noerror: Copy the code from shutils.copytree, update not to error if the mkdir fails
(From OE-Core rev: 08542718504d2b53d140a9e6be73c84cc0e047e0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/cp-noerror')
-rwxr-xr-xscripts/cp-noerror30
1 files changed, 29 insertions, 1 deletions
diff --git a/scripts/cp-noerror b/scripts/cp-noerror
index fdb3d2d..f0cd243 100755
--- a/scripts/cp-noerror
+++ b/scripts/cp-noerror
@@ -5,10 +5,38 @@
5# 5#
6 6
7import sys 7import sys
8import os
8import shutil 9import shutil
9 10
11def copytree(src, dst, symlinks=False, ignore=None):
12 """Based on shutil.copytree"""
13 names = os.listdir(src)
14 try:
15 os.makedirs(dst)
16 except OSError:
17 # Already exists
18 pass
19 errors = []
20 for name in names:
21 srcname = os.path.join(src, name)
22 dstname = os.path.join(dst, name)
23 try:
24 shutil.copy2(srcname, dstname)
25 # catch the Error from the recursive copytree so that we can
26 # continue with other files
27 except shutil.Error, err:
28 errors.extend(err.args[0])
29 except EnvironmentError, why:
30 errors.append((srcname, dstname, str(why)))
31 try:
32 shutil.copystat(src, dst)
33 except OSError, why:
34 errors.extend((src, dst, str(why)))
35 if errors:
36 raise shutil.Error, errors
37
10try: 38try:
11 shutil.copytree(sys.argv[1], sys.argv[2]) 39 copytree(sys.argv[1], sys.argv[2])
12except shutil.Error: 40except shutil.Error:
13 pass 41 pass
14 42