Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions snakemake_interface_software_deployment_plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,16 @@
from snakemake_interface_common.software import SoftwareReport


@dataclass
class SuffixReplacement:
old_suffixes: List[str]
new_suffix: str


@dataclass
class EnvSpecSourceFile:
path_or_uri: Union[str, Path]
suffix_replacement: Optional[SuffixReplacement] = None
cached: Optional[Path] = field(repr=False, default=None)

def __eq__(self, other) -> bool:
Expand All @@ -46,6 +53,18 @@ def __eq__(self, other) -> bool:
def __hash__(self) -> int:
return hash(self.path_or_uri)

def replace_suffix(
self, suffixes: List[str], new_suffix: str
) -> "EnvSpecSourceFile":
if self.suffix_replacement is not None:
raise ValueError("Suffix replacement already defined for this source file.")
return EnvSpecSourceFile(
path_or_uri=self.path_or_uri,
suffix_replacement=SuffixReplacement(
old_suffixes=suffixes, new_suffix=new_suffix
),
)


class EnvSpecBase(ABC):
@classmethod
Expand Down Expand Up @@ -306,6 +325,7 @@ def _managed_generic_hash(self, kind: str) -> str:
if store is None:
record_hash = f"record_{kind}"
hash_object = hashlib.md5(usedforsecurity=False)
breakpoint()
Comment thread
johanneskoester marked this conversation as resolved.
if self.within is not None and self.hash_include_within():
# For within, we always take the normal hash,
# since the deployment just runs within that.
Expand Down
Loading