Skip to content

Commit 5e4660c

Browse files
committed
maintenance: simplify copytree_with_merge
Remove two parameters that are always used with default values and the logic associated with dealing with non-default values
1 parent 5654e29 commit 5e4660c

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

cwltool/utils.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,16 @@ def aslist(l): # type: (Any) -> List[Any]
5252
return l
5353
return [l]
5454

55-
def copytree_with_merge(src, dst, symlinks=False, ignore=None):
56-
# type: (Text, Text, bool, Callable[..., Any]) -> None
55+
def copytree_with_merge(src, dst): # type: (Text, Text) -> None
5756
if not os.path.exists(dst):
5857
os.makedirs(dst)
5958
shutil.copystat(src, dst)
6059
lst = os.listdir(src)
61-
if ignore:
62-
excl = ignore(src, lst)
63-
lst = [x for x in lst if x not in excl]
6460
for item in lst:
6561
spath = os.path.join(src, item)
6662
dpath = os.path.join(dst, item)
67-
if symlinks and os.path.islink(spath):
68-
if os.path.lexists(dpath):
69-
os.remove(dpath)
70-
os.symlink(os.readlink(spath), dpath)
71-
try:
72-
s_stat = os.lstat(spath)
73-
mode = stat.S_IMODE(s_stat.st_mode)
74-
os.lchmod(dpath, mode)
75-
except:
76-
pass # lchmod not available, only available on unix
77-
elif os.path.isdir(spath):
78-
copytree_with_merge(spath, dpath, symlinks, ignore)
63+
if os.path.isdir(spath):
64+
copytree_with_merge(spath, dpath)
7965
else:
8066
shutil.copy2(spath, dpath)
8167

@@ -144,7 +130,6 @@ def onWindows():
144130
return os.name == 'nt'
145131

146132

147-
148133
def convert_pathsep_to_unix(path): # type: (Text) -> (Text)
149134
"""
150135
On windows os.path.join would use backslash to join path, since we would

0 commit comments

Comments
 (0)