From 0e56bded7f540854717af85e1cd9bc6c3763bbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Sat, 8 Jan 2022 22:51:13 +0100 Subject: [PATCH 1/2] fix: fix source cache handling for remote source files retrieved via github() or gitlab() tags. --- snakemake/sourcecache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snakemake/sourcecache.py b/snakemake/sourcecache.py index 3d7a5bf1f..77224c949 100644 --- a/snakemake/sourcecache.py +++ b/snakemake/sourcecache.py @@ -237,7 +237,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() From 40fc4b273231a4e1020d16536168034f59b15367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Tue, 11 Jan 2022 17:28:04 +0100 Subject: [PATCH 2/2] fix: convert to url separators in windows case. --- snakemake/sourcecache.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/snakemake/sourcecache.py b/snakemake/sourcecache.py index 77224c949..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,