From 704191b15a638bbd8e119426bfa1538ab54fdb11 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 4 Aug 2022 18:55:46 +0300 Subject: [PATCH] output: resolve relative to stage.wdir only on the same fs Leftover from https://github.com/iterative/dvc/pull/8091 --- dvc/output.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dvc/output.py b/dvc/output.py index 38b20898e..fb7c0be55 100644 --- a/dvc/output.py +++ b/dvc/output.py @@ -342,18 +342,21 @@ class Output: def _parse_path(self, fs, fs_path): parsed = urlparse(self.def_path) - if parsed.scheme != "remote": + if ( + parsed.scheme != "remote" + and self.stage + and self.stage.repo.fs == fs + and not fs.path.isabs(fs_path) + ): # NOTE: we can path either from command line or .dvc file, # so we should expect both posix and windows style paths. # paths accepts both, i.e. / works everywhere, \ only on win. # # FIXME: if we have Windows path containing / or posix one with \ # then we have #2059 bug and can't really handle that. - if self.stage and not os.path.isabs(fs_path): - fs_path = fs.path.join(self.stage.wdir, fs_path) + fs_path = fs.path.join(self.stage.wdir, fs_path) - abs_p = fs.path.abspath(fs.path.normpath(fs_path)) - return abs_p + return fs.path.abspath(fs.path.normpath(fs_path)) def __repr__(self): return "{class_name}: '{def_path}'".format(