diff --git a/src/python/jw/pkg/lib/util.py b/src/python/jw/pkg/lib/util.py index 04690684..af6b6b2a 100644 --- a/src/python/jw/pkg/lib/util.py +++ b/src/python/jw/pkg/lib/util.py @@ -204,7 +204,9 @@ async def copy( s_path = f'{src_path}/{dirent}' if src_path else dirent d_path = f'{dst_path}/{dirent}' if dst_path else dirent s_st = await ctx.src.stat(s_path) - if s_st.is_dir: + # -- Descend into directories that are not fetchable + # whole; an entry, which is both, lands as a file + if s_st.is_dir and not s_st.is_gettable: ret.extend(await __copy_tree(s_path, d_path)) continue result = await ctx.src.get(s_path, throw = True) @@ -256,8 +258,8 @@ async def copy( if basename and await ctx.dst.is_dir(ret): ret += '/' + basename src_root = '' if ctx.src.chroot else ctx.src.root - - if recursive and await ctx.src.is_dir(src_root): + s_st = await ctx.src.stat(src_root) + if recursive and s_st.is_dir and not s_st.is_gettable: return await __copy_tree(src_root, ret) result = await ctx.src.get(src_root, throw = True) @@ -267,7 +269,7 @@ async def copy( owner = owner, group = group, mode = mode, - ftype = (await ctx.src.stat(src_root)).ftype, + ftype = s_st.ftype, throw = True, ) return ret