diff --git a/snakemake/sourcecache.py b/snakemake/sourcecache.py index 3d7a5bf1f..2566ea7d5 100644 --- a/snakemake/sourcecache.py +++ b/snakemake/sourcecache.py @@ -13,7 +13,13 @@ from abc import ABC, abstractmethod -from snakemake.common import is_local_file, get_appdirs, parse_uri, smart_join +from snakemake.common import ( + ON_WINDOWS, + is_local_file, + get_appdirs, + parse_uri, + smart_join, +) from snakemake.exceptions import WorkflowError, SourceFileError from snakemake.io import git_content, split_git_path from snakemake.logging import logger @@ -202,6 +208,10 @@ def get_basedir(self): def join(self, path): path = os.path.normpath("{}/{}".format(self.path, path)) + if ON_WINDOWS: + # convert back to URL separators + # (win specific separators are introduced by normpath above) + path = path.replace("\\", "/") return self.__class__( repo=self.repo, path=path, @@ -237,7 +247,7 @@ def get_path_or_uri(self): def infer_source_file(path_or_uri, basedir: SourceFile = None): if isinstance(path_or_uri, SourceFile): - if basedir is None: + if basedir is None or isinstance(path_or_uri, HostingProviderFile): return path_or_uri else: path_or_uri = path_or_uri.get_path_or_uri()