mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-12-16 06:50:21 +00:00
file_copy: Allow copying directories
This commit is contained in:
parent
611154a426
commit
1000430aa0
2 changed files with 6 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ def validate_manifest(data, validator, error):
|
||||||
|
|
||||||
for i, file_entry in enumerate(data['plugins']['file_copy']['files']):
|
for i, file_entry in enumerate(data['plugins']['file_copy']['files']):
|
||||||
srcfile = file_entry['src']
|
srcfile = file_entry['src']
|
||||||
if not os.path.isfile(srcfile):
|
if not os.path.exists(srcfile):
|
||||||
msg = 'The source file %s does not exist.' % srcfile
|
msg = 'The source file %s does not exist.' % srcfile
|
||||||
error(msg, ['plugins', 'file_copy', 'files', i])
|
error(msg, ['plugins', 'file_copy', 'files', i])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,5 +47,9 @@ class FileCopyCommand(Task):
|
||||||
# note that we don't use os.path.join because it can't
|
# note that we don't use os.path.join because it can't
|
||||||
# handle absolute paths, which 'dst' most likely is.
|
# handle absolute paths, which 'dst' most likely is.
|
||||||
final_destination = os.path.normpath("%s/%s" % (info.root, file_entry['dst']))
|
final_destination = os.path.normpath("%s/%s" % (info.root, file_entry['dst']))
|
||||||
shutil.copy(file_entry['src'], final_destination)
|
if os.path.isfile(file_entry['src']):
|
||||||
|
shutil.copy(file_entry['src'], final_destination)
|
||||||
|
else:
|
||||||
|
shutil.copytree(file_entry['src'], final_destination)
|
||||||
|
|
||||||
modify_path(info, file_entry['dst'], file_entry)
|
modify_path(info, file_entry['dst'], file_entry)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue