@@ -445,7 +445,7 @@ def check_and_install_pre_commit():
445445 print ("Run 'pre-commit install' failed. Please install pre-commit: pip install pre-commit" )
446446 exit (0 )
447447
448- def run_git_command (command , cwd = None , check = True ):
448+ def run_shell_command (command , cwd = None , check = True ):
449449 try :
450450 subprocess .run (command , cwd = cwd , check = check , shell = True , capture_output = True , text = True )
451451 return True
@@ -492,15 +492,15 @@ def apply_patch_safely(patch_file_path, repo_path):
492492
493493 if has_uncommitted_changes (repo_path ):
494494 print (f"⚠️ Uncommitted changes detected. Running `git reset --hard` for { repo_path } " )
495- if not run_git_command ("git reset --hard" , cwd = repo_path ):
495+ if not run_shell_command ("git reset --hard" , cwd = repo_path ):
496496 print ("❌ Failed to reset changes!" )
497497 return False
498498
499499 print (f"🛠️ Apply patch: { patch_file_path } " )
500- apply_success = run_git_command (f"git apply --check { patch_file_path } " , cwd = repo_path , check = False )
500+ apply_success = run_shell_command (f"git apply --check { patch_file_path } " , cwd = repo_path , check = False )
501501
502502 if apply_success :
503- if not run_git_command (f"git apply { patch_file_path } " , cwd = repo_path ):
503+ if not run_shell_command (f"git apply { patch_file_path } " , cwd = repo_path ):
504504 print ("❌ apply patch fail!" )
505505 apply_success = False
506506
@@ -512,7 +512,7 @@ def apply_patch_safely(patch_file_path, repo_path):
512512 print (f" cd { repo_path } && git apply { patch_file_path } " )
513513 return False
514514
515- def apply_patch ():
515+ def pre_build ():
516516 if os .path .exists ("third_party/custom_patch" ):
517517 script_path = os .path .dirname (os .path .abspath (__file__ ))
518518 mooncake_repo_path = os .path .join (script_path , "third_party/Mooncake" )
@@ -521,6 +521,9 @@ def apply_patch():
521521 cpprestsdk_repo_path = os .path .join (script_path , "third_party/cpprestsdk" )
522522 if not apply_patch_safely ("../custom_patch/cpprestsdk.patch" , cpprestsdk_repo_path ):
523523 exit (0 )
524+ if not run_shell_command ("sh third_party/dependencies.sh" , cwd = script_path ):
525+ print ("❌ Failed to reset changes!" )
526+ exit (0 )
524527
525528if __name__ == "__main__" :
526529 device = 'a2' # default
@@ -537,9 +540,10 @@ def apply_patch():
537540 del sys .argv [idx ]
538541 del sys .argv [idx ]
539542 if '--dry_run' not in sys .argv :
540- apply_patch ()
543+ pre_build ()
541544 else :
542545 sys .argv .remove ("--dry_run" )
546+
543547 if '--install-xllm-kernels' in sys .argv :
544548 idx = sys .argv .index ('--install-xllm-kernels' )
545549 if idx + 1 < len (sys .argv ):
0 commit comments