fix windows path handling

This commit is contained in:
Saugat Pachhai (सौगात)
2022-12-01 15:56:26 +01:00
committed by David de la Iglesia Castro
parent 28402dedf1
commit d57bb23c93
2 changed files with 20 additions and 10 deletions
+10 -5
View File
@@ -9,7 +9,12 @@ from dvc.output import Output
from dvc.repo import locked
from dvc.repo.collect import StrPaths, collect
from dvc.scm import NoSCMError
from dvc.utils import error_handler, errored_revisions, onerror_collect
from dvc.utils import (
as_posix,
error_handler,
errored_revisions,
onerror_collect,
)
from dvc.utils.collections import ensure_list
from dvc.utils.serialize import load_path
@@ -31,12 +36,12 @@ def _to_fs_paths(metrics: List[Output]) -> StrPaths:
def _collect_top_level_metrics(repo):
top_metrics = repo.index._top_metrics # pylint: disable=protected-access
for dvcfile, metrics in top_metrics.items():
wdir = repo.dvcfs.path.relpath(
repo.dvcfs.path.parent(dvcfile), repo.root_dir
wdir = repo.fs.path.relpath(
repo.fs.path.parent(dvcfile), repo.root_dir
)
for file in metrics:
path = repo.dvcfs.path.join(wdir, file)
yield repo.dvcfs.path.normpath(path)
path = repo.fs.path.join(wdir, as_posix(file))
yield repo.fs.path.normpath(path)
def _collect_metrics(repo, targets, revision, recursive):
+10 -5
View File
@@ -20,7 +20,12 @@ from dvc.repo.collect import collect
from dvc.scm import NoSCMError
from dvc.stage import PipelineStage
from dvc.ui import ui
from dvc.utils import error_handler, errored_revisions, onerror_collect
from dvc.utils import (
as_posix,
error_handler,
errored_revisions,
onerror_collect,
)
from dvc.utils.collections import ensure_list
from dvc.utils.serialize import load_path
@@ -38,12 +43,12 @@ def _is_params(dep: "Output"):
def _collect_top_level_params(repo):
top_params = repo.index._top_params # pylint: disable=protected-access
for dvcfile, params in top_params.items():
wdir = repo.dvcfs.path.relpath(
repo.dvcfs.path.parent(dvcfile), repo.root_dir
wdir = repo.fs.path.relpath(
repo.fs.path.parent(dvcfile), repo.root_dir
)
for file in params:
path = repo.dvcfs.path.join(wdir, file)
yield repo.dvcfs.path.normpath(path)
path = repo.fs.path.join(wdir, as_posix(file))
yield repo.fs.path.normpath(path)
def _collect_configs(