99import nf_core .modules .modules_utils
1010import nf_core .utils
1111from nf_core .components .components_command import ComponentCommand
12+ from nf_core .components .components_differ import ComponentsDiffer
1213from nf_core .components .components_utils import (
1314 get_components_to_install ,
1415 prompt_component_version_sha ,
1516)
1617from nf_core .components .install import ComponentInstall
1718from nf_core .components .remove import ComponentRemove
18- from nf_core .modules .modules_differ import ModulesDiffer
1919from nf_core .modules .modules_json import ModulesJson
2020from nf_core .modules .modules_repo import ModulesRepo
2121from nf_core .utils import plural_es , plural_s , plural_y
@@ -223,7 +223,7 @@ def update(self, component=None, silent=False, updated=None, check_diff_exist=Tr
223223 f"Writing diff file for { self .component_type [:- 1 ]} '{ component_fullname } ' to '{ self .save_diff_fn } '"
224224 )
225225 try :
226- ModulesDiffer .write_diff_file (
226+ ComponentsDiffer .write_diff_file (
227227 self .save_diff_fn ,
228228 component ,
229229 modules_repo .repo_path ,
@@ -265,7 +265,7 @@ def update(self, component=None, silent=False, updated=None, check_diff_exist=Tr
265265 self .manage_changes_in_linked_components (component , modules_to_update , subworkflows_to_update )
266266
267267 elif self .show_diff :
268- ModulesDiffer .print_diff (
268+ ComponentsDiffer .print_diff (
269269 component ,
270270 modules_repo .repo_path ,
271271 component_dir ,
@@ -313,7 +313,7 @@ def update(self, component=None, silent=False, updated=None, check_diff_exist=Tr
313313
314314 if self .save_diff_fn :
315315 # Write the modules.json diff to the file
316- ModulesDiffer .append_modules_json_diff (
316+ ComponentsDiffer .append_modules_json_diff (
317317 self .save_diff_fn ,
318318 old_modules_json ,
319319 self .modules_json .get_modules_json (),
@@ -449,7 +449,9 @@ def get_single_component_info(self, component):
449449 self .modules_repo .setup_branch (current_branch )
450450
451451 # If there is a patch file, get its filename
452- patch_fn = self .modules_json .get_patch_fn (component , self .modules_repo .remote_url , install_dir )
452+ patch_fn = self .modules_json .get_patch_fn (
453+ self .component_type , component , self .modules_repo .remote_url , install_dir
454+ )
453455
454456 return (self .modules_repo , component , sha , patch_fn )
455457
@@ -695,7 +697,12 @@ def get_all_components_info(self, branch=None):
695697
696698 # Add patch filenames to the components that have them
697699 components_info = [
698- (repo , comp , sha , self .modules_json .get_patch_fn (comp , repo .remote_url , repo .repo_path ))
700+ (
701+ repo ,
702+ comp ,
703+ sha ,
704+ self .modules_json .get_patch_fn (self .component_type , comp , repo .remote_url , repo .repo_path ),
705+ )
699706 for repo , comp , sha in components_info
700707 ]
701708
@@ -810,7 +817,9 @@ def try_apply_patch(
810817 shutil .copytree (component_install_dir , temp_component_dir )
811818
812819 try :
813- new_files = ModulesDiffer .try_apply_patch (component , repo_path , patch_path , temp_component_dir )
820+ new_files = ComponentsDiffer .try_apply_patch (
821+ self .component_type , component , repo_path , patch_path , temp_component_dir
822+ )
814823 except LookupError :
815824 # Patch failed. Save the patch file by moving to the install dir
816825 shutil .move (patch_path , Path (component_install_dir , patch_path .relative_to (component_dir )))
@@ -828,7 +837,7 @@ def try_apply_patch(
828837
829838 # Create the new patch file
830839 log .debug ("Regenerating patch file" )
831- ModulesDiffer .write_diff_file (
840+ ComponentsDiffer .write_diff_file (
832841 Path (temp_component_dir , patch_path .relative_to (component_dir )),
833842 component ,
834843 repo_path ,
@@ -848,7 +857,12 @@ def try_apply_patch(
848857
849858 # Add the patch file to the modules.json file
850859 self .modules_json .add_patch_entry (
851- component , self .modules_repo .remote_url , repo_path , patch_relpath , write_file = write_file
860+ self .component_type ,
861+ component ,
862+ self .modules_repo .remote_url ,
863+ repo_path ,
864+ patch_relpath ,
865+ write_file = write_file ,
852866 )
853867
854868 return True
0 commit comments