@@ -61,12 +61,12 @@ def try_restore_dependencies(self, document: Document) -> Optional[Document]:
6161 build_dep_tree_path (document .absolute_path , restore_file_path_item )
6262 for restore_file_path_item in self .get_lock_file_names ()
6363 ]
64- restore_file_path = self .get_any_restore_file_already_exist (restore_file_paths )
64+ restore_file_path = self .get_any_restore_file_already_exist (document , restore_file_paths )
6565 relative_restore_file_path = build_dep_tree_path (
6666 document .path , self .get_restored_lock_file_name (restore_file_path )
6767 )
6868
69- if self .verify_lockfile_missing (restore_file_path ):
69+ if not self .verify_restore_file_already_exist (restore_file_path ):
7070 output = execute_commands (
7171 commands = self .get_commands (manifest_file_path ),
7272 timeout = self .command_timeout ,
@@ -85,17 +85,16 @@ def get_working_directory(self, document: Document) -> Optional[str]:
8585 def get_restored_lock_file_name (self , restore_file_path : str ) -> str :
8686 return self .get_lock_file_name ()
8787
88- @staticmethod
89- def get_any_restore_file_already_exist (restore_file_paths : list [str ]) -> Optional [str ]:
88+ def get_any_restore_file_already_exist (self , document : Document , restore_file_paths : list [str ]) -> Optional [str ]:
9089 for restore_file_path in restore_file_paths :
9190 if os .path .isfile (restore_file_path ):
9291 return restore_file_path
9392
94- return None
93+ return build_dep_tree_path ( document . absolute_path , self . get_lock_file_name ())
9594
9695 @staticmethod
97- def verify_lockfile_missing (restore_file_path : Optional [str ]) -> bool :
98- return restore_file_path is None
96+ def verify_restore_file_already_exist (restore_file_path : Optional [str ]) -> bool :
97+ return os . path . isfile ( restore_file_path )
9998
10099 @abstractmethod
101100 def is_project (self , document : Document ) -> bool :
0 commit comments