Skip to content

Commit

Permalink
fix: fix source cache handling for remote source files retrieved via …
Browse files Browse the repository at this point in the history
…github() or gitlab() tags. (#1322)

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

* fix: convert to url separators in windows case.
  • Loading branch information
johanneskoester committed Jan 11, 2022
1 parent aa2c265 commit 6e2ecd2
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit 6e2ecd2

Please sign in to comment.