Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix source cache handling for remote source files retrieved via github() or gitlab() tags. #1322

Merged
merged 2 commits into from Jan 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions snakemake/sourcecache.py
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down