From 6200652b9aff2362a63581cee58eb9f9cae189da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Sat, 5 Feb 2022 18:58:57 +0100 Subject: [PATCH] fix: fix assertion error in conda env file spec when applying wildcards (thanks @ddesvillechabrol) (#1377) * fix: fix assertion error in conda env file spec when applying wildcards * fix arg passing * fix arg number --- snakemake/deployment/conda.py | 6 +++--- snakemake/rules.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/snakemake/deployment/conda.py b/snakemake/deployment/conda.py index 8bb7327b9..e19cb86d9 100644 --- a/snakemake/deployment/conda.py +++ b/snakemake/deployment/conda.py @@ -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() @@ -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): diff --git a/snakemake/rules.py b/snakemake/rules.py index 1e6a4e19e..e9b2671ef 100644 --- a/snakemake/rules.py +++ b/snakemake/rules.py @@ -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(