Skip to content
Snippets Groups Projects

Resolve "publish: Copy src directories correctly"

Merged Mayr, Hannes requested to merge 77-publish-copy-src-directories-correctly into dev
1 unresolved thread
+ 6
1
@@ -211,7 +211,12 @@ class PublishOptions:
@@ -211,7 +211,12 @@ class PublishOptions:
# Copy data to destination folder
# Copy data to destination folder
for path in self.src_datapaths:
for path in self.src_datapaths:
try:
try:
shutil.copytree(path, destination, dirs_exist_ok=True)
_, src_dir_name = os.path.split(path)
 
# Create new dst directory to include the top level directory of
 
# the source files. So that copying A to B results in B/A and not only
 
# the contents of A to B.
 
new_destination = os.path.join(destination, src_dir_name)
 
shutil.copytree(path, new_destination, dirs_exist_ok=True)
except NotADirectoryError:
except NotADirectoryError:
shutil.copy2(path, destination)
shutil.copy2(path, destination)
Loading