diff --git a/src/python/jw/pkg/lib/util.py b/src/python/jw/pkg/lib/util.py index af6b6b2a..49851be9 100644 --- a/src/python/jw/pkg/lib/util.py +++ b/src/python/jw/pkg/lib/util.py @@ -179,22 +179,6 @@ async def copy( parents: bool = False, ) -> Exception | str | list[str]: - # Destination address / addresses - ret: str | list[str] - if not isinstance(src, (str, FileContext)): - ret = [] - for uri in src: # TODO: Group identical netlocs into one CopyContext - rr = await copy(uri, dst, owner, group, mode, throw, recursive, parents) - if isinstance(rr, Exception): - return rr - if isinstance(rr, list): - ret.extend(rr) - if isinstance(rr, str): - ret.append(rr) - else: - raise Exception(f'copy() returned unexpected type {type(rr)}') - return ret - async def __copy_tree(src_path: str, dst_path: str) -> list[str]: ret: list[str] = [] s_st = await ctx.src.stat(src_path) @@ -222,6 +206,22 @@ async def copy( ret.append(d_path) return ret + # Destination address / addresses + ret: str | list[str] + if not isinstance(src, (str, FileContext)): + ret = [] + for uri in src: # TODO: Group identical netlocs into one CopyContext + rr = await copy(uri, dst, owner, group, mode, throw, recursive, parents) + if isinstance(rr, Exception): + return rr + if isinstance(rr, list): + ret.extend(rr) + if isinstance(rr, str): + ret.append(rr) + else: + raise Exception(f'copy() returned unexpected type {type(rr)}') + return ret + try: from .CopyContext import CopyContext