@@ -745,14 +745,18 @@ def git_submodule_update():
745745def fetch_data_repos ():
746746 """Fetches data repositories (game-patches, optimized-settings) into .data_repos/.
747747
748- These repos are cloned fresh or updated to their latest versions . They are not
749- submodules to avoid constant submodule updates in the main repo.
748+ Removes and re-clones all data repos fresh each time . They are not submodules
749+ to avoid constant submodule updates in the main repo.
750750 """
751751 print ("- fetching data repositories..." )
752752
753753 data_dir = ".data_repos"
754- if not os .path .exists (data_dir ):
755- os .makedirs (data_dir )
754+ if os .path .exists (data_dir ):
755+ def remove_readonly (func , path , _ ):
756+ os .chmod (path , stat .S_IWRITE )
757+ func (path )
758+ rmtree (data_dir , onerror = remove_readonly )
759+ os .makedirs (data_dir )
756760
757761 # Define data repos
758762 data_repos = [
@@ -768,42 +772,18 @@ def fetch_data_repos():
768772 }
769773 ]
770774
771- # Clone or update each repo
775+ # Clone each repo fresh
772776 for repo in data_repos :
773777 repo_path = os .path .join (data_dir , repo ["name" ])
774-
775- if os .path .exists (repo_path ):
776- print (f" - updating { repo ['name' ]} ..." )
777- try :
778- shell_call ([
779- "git" ,
780- "-C" , repo_path ,
781- "pull" ,
782- "--depth=1" ,
783- "origin" , repo ["branch" ]
784- ])
785- except Exception as e :
786- print (f" Warning: Failed to update { repo ['name' ]} : { e } " )
787- print (f" Removing and re-cloning..." )
788- rmtree (repo_path )
789- shell_call ([
790- "git" ,
791- "clone" ,
792- "--depth=1" ,
793- "--branch" , repo ["branch" ],
794- repo ["url" ],
795- repo_path
796- ])
797- else :
798- print (f" - cloning { repo ['name' ]} ..." )
799- shell_call ([
800- "git" ,
801- "clone" ,
802- "--depth=1" ,
803- "--branch" , repo ["branch" ],
804- repo ["url" ],
805- repo_path
806- ])
778+ print (f" - cloning { repo ['name' ]} ..." )
779+ shell_call ([
780+ "git" ,
781+ "clone" ,
782+ "--depth=1" ,
783+ "--branch" , repo ["branch" ],
784+ repo ["url" ],
785+ repo_path
786+ ])
807787
808788
809789def get_cc (cc = None ):
0 commit comments