@@ -471,7 +471,7 @@ def check_and_install_pre_commit():
471471 print ("Run 'pre-commit install' failed. Please install pre-commit: pip install pre-commit" )
472472 exit (0 )
473473
474- def run_git_command (command , cwd = None , check = True ):
474+ def run_shell_command (command , cwd = None , check = True ):
475475 try :
476476 subprocess .run (command , cwd = cwd , check = check , shell = True , capture_output = True , text = True )
477477 return True
@@ -518,15 +518,15 @@ def apply_patch_safely(patch_file_path, repo_path):
518518
519519 if has_uncommitted_changes (repo_path ):
520520 print (f"⚠️ Uncommitted changes detected. Running `git reset --hard` for { repo_path } " )
521- if not run_git_command ("git reset --hard" , cwd = repo_path ):
521+ if not run_shell_command ("git reset --hard" , cwd = repo_path ):
522522 print ("❌ Failed to reset changes!" )
523523 return False
524524
525525 print (f"🛠️ Apply patch: { patch_file_path } " )
526- apply_success = run_git_command (f"git apply --check { patch_file_path } " , cwd = repo_path , check = False )
526+ apply_success = run_shell_command (f"git apply --check { patch_file_path } " , cwd = repo_path , check = False )
527527
528528 if apply_success :
529- if not run_git_command (f"git apply { patch_file_path } " , cwd = repo_path ):
529+ if not run_shell_command (f"git apply { patch_file_path } " , cwd = repo_path ):
530530 print ("❌ apply patch fail!" )
531531 apply_success = False
532532
@@ -538,7 +538,7 @@ def apply_patch_safely(patch_file_path, repo_path):
538538 print (f" cd { repo_path } && git apply { patch_file_path } " )
539539 return False
540540
541- def apply_patch ():
541+ def pre_build ():
542542 if os .path .exists ("third_party/custom_patch" ):
543543 script_path = os .path .dirname (os .path .abspath (__file__ ))
544544 mooncake_repo_path = os .path .join (script_path , "third_party/Mooncake" )
@@ -547,6 +547,9 @@ def apply_patch():
547547 cpprestsdk_repo_path = os .path .join (script_path , "third_party/cpprestsdk" )
548548 if not apply_patch_safely ("../custom_patch/cpprestsdk.patch" , cpprestsdk_repo_path ):
549549 exit (0 )
550+ if not run_shell_command ("sh third_party/dependencies.sh" , cwd = script_path ):
551+ print ("❌ Failed to reset changes!" )
552+ exit (0 )
550553
551554if __name__ == "__main__" :
552555 device = 'a2' # default
@@ -563,9 +566,10 @@ def apply_patch():
563566 del sys .argv [idx ]
564567 del sys .argv [idx ]
565568 if '--dry_run' not in sys .argv :
566- apply_patch ()
569+ pre_build ()
567570 else :
568571 sys .argv .remove ("--dry_run" )
572+
569573 if '--install-xllm-kernels' in sys .argv :
570574 idx = sys .argv .index ('--install-xllm-kernels' )
571575 if idx + 1 < len (sys .argv ):
0 commit comments