Skip to content
Permalink
Browse files
fix: do not apply module prefix in case of remote files
  • Loading branch information
johanneskoester committed Feb 26, 2022
1 parent 2681f6f commit 5645b3f75066d8d1d8841b6e6732cd8ad098f67f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
@@ -52,11 +52,15 @@ def modify(self, path, property=None):
return modified_path

def replace_prefix(self, path, property=None):
if (
self.trie is None and self.prefix is None
) or property in self.skip_properties:
if (self.trie is None and self.prefix is None) or (
property in self.skip_properties
or os.path.isabs(path)
or path.startswith("..")
or is_flagged(path, "remote_object")
):
# no replacement
return path

if self.trie is not None:
prefixes = self.trie.prefix_items(str(path))
if len(prefixes) > 1:
@@ -74,10 +78,8 @@ def replace_prefix(self, path, property=None):
else:
# no matching prefix
return path

# prefix case
if os.path.isabs(path) or path.startswith(".."):
# do not apply prefix if path is not within the workdir
return path
return self.prefix + path

def apply_default_remote(self, path):
@@ -1,13 +1,21 @@
configfile: "config.yaml" # does not exist, but this statement should be ignored on module import
from snakemake.remote.HTTP import RemoteProvider as HTTPRemoteProvider


configfile: "config.yaml" # does not exist, but this statement should be ignored on module import


HTTP = HTTPRemoteProvider()


def some_func():
return 15


rule a:
input:
HTTP.remote("raw.githubusercontent.com/snakemake/snakemake/main/LICENSE.md"),
output:
"results/test.out",
"/tmp/foo.txt"
"/tmp/foo.txt",
shell:
"echo {config[test]} > {output[0]}; touch {output[1]}"
"echo {config[test]} > {output[0]}; touch {output[1]}"

0 comments on commit 5645b3f

Please sign in to comment.