Skip to content

Commit

Permalink
fix: fix assertion error in conda env file spec when applying wildcar…
Browse files Browse the repository at this point in the history
…ds (thanks @ddesvillechabrol) (#1377)

* fix: fix assertion error in conda env file spec when applying wildcards

* fix arg passing

* fix arg number
  • Loading branch information
johanneskoester committed Feb 5, 2022
1 parent c45d47a commit 6200652
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions snakemake/deployment/conda.py
Expand Up @@ -704,12 +704,12 @@ def __init__(self, filepath: str, rule=None):
else:
self.file = IOFile(filepath, rule=rule)

def apply_wildcards(self, wildcards):
def apply_wildcards(self, wildcards, rule):
filepath = self.file.apply_wildcards(wildcards)
if is_local_file(filepath):
# Normalize 'file:///my/path.yml' to '/my/path.yml'
filepath = parse_uri(filepath).uri_path
return CondaEnvFileSpec(filepath)
return CondaEnvFileSpec(filepath, rule)

def check(self):
self.file.check()
Expand All @@ -736,7 +736,7 @@ class CondaEnvNameSpec(CondaEnvSpec):
def __init__(self, name: str):
self.name = name

def apply_wildcards(self, wildcards):
def apply_wildcards(self, wildcards, _):
return CondaEnvNameSpec(apply_wildcards(self.name, wildcards))

def get_conda_env(self, workflow, env_dir=None, container_img=None, cleanup=None):
Expand Down
4 changes: 3 additions & 1 deletion snakemake/rules.py
Expand Up @@ -1050,7 +1050,9 @@ def expand_group(self, wildcards):
def expand_conda_env(self, wildcards):
try:
conda_env = (
self.conda_env.apply_wildcards(wildcards) if self.conda_env else None
self.conda_env.apply_wildcards(wildcards, self)
if self.conda_env
else None
)
except WildcardError as e:
raise WildcardError(
Expand Down

0 comments on commit 6200652

Please sign in to comment.