Fix T50244: bam pack with -m FILE fails on copying deeper hierachies because of missing destination folders.
As suggested by reporter, check for existing dst dir and use os.makedirs first if missing.
This commit is contained in:
@@ -513,6 +513,9 @@ def pack(
|
|||||||
if (not os.path.exists(src)) or os.path.isdir(src):
|
if (not os.path.exists(src)) or os.path.isdir(src):
|
||||||
yield report(" %s: %r\n" % (colorize("source missing", color='red'), src))
|
yield report(" %s: %r\n" % (colorize("source missing", color='red'), src))
|
||||||
else:
|
else:
|
||||||
|
dst_dir = os.path.dirname(dst)
|
||||||
|
if not os.path.exists(dst_dir):
|
||||||
|
os.makedirs(dst_dir)
|
||||||
yield report(" %s: %r -> %r\n" % (colorize("copying", color='blue'), src, dst))
|
yield report(" %s: %r -> %r\n" % (colorize("copying", color='blue'), src, dst))
|
||||||
shutil.copy(src, dst)
|
shutil.copy(src, dst)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user