3333from snakemake_interface_common .software import SoftwareReport
3434
3535
36+ @dataclass
37+ class SuffixReplacement :
38+ old_suffixes : List [str ]
39+ new_suffix : str
40+
41+
3642@dataclass
3743class EnvSpecSourceFile :
3844 path_or_uri : Union [str , Path ]
45+ suffix_replacement : Optional [SuffixReplacement ] = None
3946 cached : Optional [Path ] = field (repr = False , default = None )
4047
4148 def __eq__ (self , other ) -> bool :
@@ -46,6 +53,16 @@ def __eq__(self, other) -> bool:
4653 def __hash__ (self ) -> int :
4754 return hash (self .path_or_uri )
4855
56+ def replace_suffix (self , suffixes : List [str ], new_suffix : str ) -> "EnvSpecSourceFile" :
57+ if self .suffix_replacement is not None :
58+ raise ValueError ("Suffix replacement already defined for this source file." )
59+ return EnvSpecSourceFile (
60+ path_or_uri = self .path_or_uri ,
61+ suffix_replacement = SuffixReplacement (
62+ old_suffixes = suffixes , new_suffix = new_suffix
63+ ),
64+ )
65+
4966
5067class EnvSpecBase (ABC ):
5168 @classmethod
@@ -306,6 +323,7 @@ def _managed_generic_hash(self, kind: str) -> str:
306323 if store is None :
307324 record_hash = f"record_{ kind } "
308325 hash_object = hashlib .md5 (usedforsecurity = False )
326+ breakpoint ()
309327 if self .within is not None and self .hash_include_within ():
310328 # For within, we always take the normal hash,
311329 # since the deployment just runs within that.
0 commit comments