1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

host: Allow pull method to deal with directories

Check to see if the the source path is a directory before attempting to
pull from the host. Use the copy_tree implementation from `distutils`
instead of `shutil` to allow copying into an existing directory.
This commit is contained in:
Marc Bonnici 2018-09-20 14:49:00 +01:00 committed by setrofim
parent b7a04c9ebc
commit f2a88fd1dc

View File

@ -18,6 +18,7 @@ import signal
import shutil import shutil
import subprocess import subprocess
import logging import logging
from distutils.dir_util import copy_tree
from getpass import getpass from getpass import getpass
from devlib.exception import TargetTransientError, TargetStableError from devlib.exception import TargetTransientError, TargetStableError
@ -55,7 +56,11 @@ class LocalConnection(object):
for each_source in iglob(source): for each_source in iglob(source):
shutil.copy(each_source, dest) shutil.copy(each_source, dest)
else: else:
shutil.copy(source, dest) if os.path.isdir(source):
# Use distutils to allow copying into an existing directory structure.
copy_tree(source, dest)
else:
shutil.copy(source, dest)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def execute(self, command, timeout=None, check_exit_code=True, def execute(self, command, timeout=None, check_exit_code=True,