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

target: Allow relative path for for push/pull

Currently, it is not possible to push/pull files with a relative path when
the destination doesn't exist. This is due to the basename resolution. Fix
this behaviour.
This commit is contained in:
Vincent Donnefort 2022-03-22 12:00:03 +00:00 committed by Marc Bonnici
parent adad59fdba
commit c29d386e81

View File

@ -517,7 +517,7 @@ class Target(object):
src_excep = HostError src_excep = HostError
src_path_kind = host_paths_kind src_path_kind = host_paths_kind
dst_mkdir = once(self.makedirs) _dst_mkdir = once(self.makedirs)
dst_path_join = self.path.join dst_path_join = self.path.join
dst_paths_kind = target_paths_kind dst_paths_kind = target_paths_kind
dst_remove_file = once(functools.partial(self.remove, as_root=as_root)) dst_remove_file = once(functools.partial(self.remove, as_root=as_root))
@ -525,13 +525,18 @@ class Target(object):
src_excep = TargetStableError src_excep = TargetStableError
src_path_kind = target_paths_kind src_path_kind = target_paths_kind
dst_mkdir = once(functools.partial(os.makedirs, exist_ok=True)) _dst_mkdir = once(functools.partial(os.makedirs, exist_ok=True))
dst_path_join = os.path.join dst_path_join = os.path.join
dst_paths_kind = host_paths_kind dst_paths_kind = host_paths_kind
dst_remove_file = once(os.remove) dst_remove_file = once(os.remove)
else: else:
raise ValueError('Unknown action "{}"'.format(action)) raise ValueError('Unknown action "{}"'.format(action))
# Handle the case where path is None
def dst_mkdir(path):
if path:
_dst_mkdir(path)
def rewrite_dst(src, dst): def rewrite_dst(src, dst):
new_dst = dst_path_join(dst, os.path.basename(src)) new_dst = dst_path_join(dst, os.path.basename(src))