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 assertion error in conda env file spec when applying wildcards (thanks @ddesvillechabrol) #1377

Merged
merged 3 commits into from Feb 5, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions snakemake/deployment/conda.py
Expand Up @@ -696,12 +696,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 @@ -728,7 +728,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