@@ -660,25 +660,22 @@ def cleanup_statedir(self) -> None:
660660 def copy_from_machine (self , source : str , target_dir : str = "" ) -> None :
661661 """Copy a file from the machine (specified by an in-machine source path) to a path
662662 relative to `$out`. The file is copied via the `shared_dir` shared among
663- all the machines (using a temporary directory) .
663+ all the machines.
664664 """
665665 # Compute the source, target, and intermediate shared file names
666666 vm_src = Path (source )
667- with tempfile .TemporaryDirectory (dir = self .shared_dir ) as shared_td :
668- shared_temp = Path (shared_td )
669- vm_shared_temp = Path ("/tmp/shared" ) / shared_temp .name
670- vm_intermediate = vm_shared_temp / vm_src .name
671- intermediate = shared_temp / vm_src .name
672- # Copy the file to the shared directory inside machines
673- self .succeed (make_command (["mkdir" , "-p" , vm_shared_temp ]))
674- self .succeed (make_command (["cp" , "-r" , vm_src , vm_intermediate ]))
675- abs_target = self .out_dir / target_dir / vm_src .name
676- abs_target .parent .mkdir (exist_ok = True , parents = True )
677- # Copy the file from the shared directory outside machines
678- if intermediate .is_dir ():
679- shutil .copytree (intermediate , abs_target )
680- else :
681- shutil .copy (intermediate , abs_target )
667+ vm_intermediate = Path ("/tmp/shared" ) / target_dir / vm_src .name
668+ intermediate = self .shared_dir / target_dir / vm_src .name
669+ # Copy the file to the shared directory inside machines
670+ self .succeed (make_command (["mkdir" , "-p" , vm_intermediate .parent ]))
671+ self .succeed (make_command (["cp" , "-r" , vm_src , vm_intermediate ]))
672+ abs_target = self .out_dir / target_dir / vm_src .name
673+ abs_target .parent .mkdir (exist_ok = True , parents = True )
674+ # Copy the file from the shared directory outside machines
675+ if intermediate .is_dir ():
676+ shutil .copytree (intermediate , abs_target )
677+ else :
678+ shutil .copy (intermediate , abs_target )
682679
683680 @warnings .deprecated ("Use copy_from_machine() instead" )
684681 def copy_from_vm (self , source : str , target_dir : str = "" ) -> None :
0 commit comments