@@ -57,8 +57,14 @@ def get_manifest_file_path(self, document: Document) -> str:
5757
5858 def try_restore_dependencies (self , document : Document ) -> Optional [Document ]:
5959 manifest_file_path = self .get_manifest_file_path (document )
60- restore_file_path = build_dep_tree_path (document .absolute_path , self .get_lock_file_name ())
61- relative_restore_file_path = build_dep_tree_path (document .path , self .get_lock_file_name ())
60+ restore_file_paths = [
61+ build_dep_tree_path (document .absolute_path , restore_file_path_item )
62+ for restore_file_path_item in self .get_lock_file_names ()
63+ ]
64+ restore_file_path = self .get_any_restore_file_already_exist (document , restore_file_paths )
65+ relative_restore_file_path = build_dep_tree_path (
66+ document .path , self .get_restored_lock_file_name (restore_file_path )
67+ )
6268
6369 if not self .verify_restore_file_already_exist (restore_file_path ):
6470 output = execute_commands (
@@ -76,6 +82,16 @@ def try_restore_dependencies(self, document: Document) -> Optional[Document]:
7682 def get_working_directory (self , document : Document ) -> Optional [str ]:
7783 return os .path .dirname (document .absolute_path )
7884
85+ def get_restored_lock_file_name (self , restore_file_path : str ) -> str :
86+ return self .get_lock_file_name ()
87+
88+ def get_any_restore_file_already_exist (self , document : Document , restore_file_paths : list [str ]) -> str :
89+ for restore_file_path in restore_file_paths :
90+ if os .path .isfile (restore_file_path ):
91+ return restore_file_path
92+
93+ return build_dep_tree_path (document .absolute_path , self .get_lock_file_name ())
94+
7995 @staticmethod
8096 def verify_restore_file_already_exist (restore_file_path : str ) -> bool :
8197 return os .path .isfile (restore_file_path )
@@ -91,3 +107,7 @@ def get_commands(self, manifest_file_path: str) -> list[list[str]]:
91107 @abstractmethod
92108 def get_lock_file_name (self ) -> str :
93109 pass
110+
111+ @abstractmethod
112+ def get_lock_file_names (self ) -> list [str ]:
113+ pass
0 commit comments