1616import shutil
1717import yaml
1818import re
19- from bdiff .git_bdiff import GitBDiff , GitInfo
20- from typing import Optional , List , Dict
19+ try :
20+ from bdiff .git_bdiff import GitBDiff , GitInfo
21+ except ImportError :
22+ from git_bdiff import GitBDiff , GitInfo
23+ from typing import Union , Optional , List , Dict
2124from pathlib import Path
2225from collections import defaultdict
2326
@@ -85,21 +88,24 @@ def clone_sources(self):
8588 """
8689 Clone the sources defined in the dependencies file, to allow reading of files
8790 and creation of diffs.
88- If the source is not a github url, then copy it using scp
91+ If the source is not a github url, then copy it using rsync
8992 """
9093
9194 for dependency , data in self .dependencies .items ():
9295 loc = self .temp_directory / dependency
9396 if data ["source" ].endswith (".git" ):
9497 commands = [
95- f"git clone { data [" source" ]} { loc } " ,
96- f"git -C { loc } checkout { data [" ref" ]} " ,
98+ f"git clone { data [' source' ]} { loc } " ,
99+ f"git -C { loc } checkout { data [' ref' ]} " ,
97100 ]
98101 for command in commands :
99102 self .run_command (command )
100103 else :
101- command = f"scp -r -o StrictHostKeyChecking=no { data ["source" ]} { loc } "
102- self .run_command (command )
104+ source = data ["source" ]
105+ if not source .endswith ("/" ):
106+ source = source + "/"
107+ command = f'rsync -e "ssh -o StrictHostKeyChecking=no" -avl { source } { loc } '
108+ self .run_command (command , shell = True )
103109
104110 def determine_primary_source (self ) -> str :
105111 """
@@ -259,7 +265,7 @@ def query_suite_database(
259265 return data
260266
261267 def run_command (
262- self , command : str , shell : bool = False , rval : bool = False
268+ self , command : Union [ str , List [ str ]] , shell : bool = False , rval : bool = False
263269 ) -> Optional [subprocess .CompletedProcess ]:
264270 """
265271 Run a subprocess command and return the result object
@@ -268,7 +274,7 @@ def run_command(
268274 Outputs:
269275 - result object from subprocess.run
270276 """
271- if not shell :
277+ if not shell and type ( command ) != list :
272278 command = command .split ()
273279 result = subprocess .run (
274280 command ,
0 commit comments