@@ -54,7 +54,9 @@ def __init__(self, master: Master, workers: int = 3):
5454 self .altered_packages : Dict [str , Set [str ]] = {}
5555
5656 async def synchronize (
57- self , specific_packages : Optional [List [str ]] = None
57+ self ,
58+ specific_packages : Optional [List [str ]] = None ,
59+ sync_simple_index : bool = True ,
5860 ) -> Dict [str , Set [str ]]:
5961 logger .info (f"Syncing with { self .master .url } ." )
6062 self .now = datetime .datetime .utcnow ()
@@ -84,7 +86,7 @@ async def synchronize(
8486 )
8587
8688 await self .sync_packages ()
87- self .finalize_sync ()
89+ self .finalize_sync (sync_index_page = sync_simple_index )
8890 return self .altered_packages
8991
9092 def _filter_packages (self ) -> None :
@@ -164,7 +166,7 @@ async def sync_packages(self) -> None:
164166 # TODO Remove this check by following packages_to_sync's typing
165167 self .on_error (e )
166168
167- def finalize_sync (self ) -> None :
169+ def finalize_sync (self , sync_index_page : bool = True ) -> None :
168170 raise NotImplementedError ()
169171
170172 def on_error (self , exception : BaseException , ** kwargs : Dict ) -> None :
@@ -341,8 +343,9 @@ async def process_package(self, package: Package) -> None:
341343 # Cleanup old legacy non PEP 503 Directories created for the Simple API
342344 await self .cleanup_non_pep_503_paths (package )
343345
344- def finalize_sync (self ) -> None :
345- self .sync_index_page ()
346+ def finalize_sync (self , sync_index_page : bool = True ) -> None :
347+ if sync_index_page :
348+ self .sync_index_page ()
346349 if self .need_wrapup :
347350 self .wrapup_successful_sync ()
348351 return None
@@ -979,7 +982,9 @@ async def download_file(
979982
980983
981984async def mirror (
982- config : configparser .ConfigParser , specific_packages : Optional [List [str ]] = None
985+ config : configparser .ConfigParser ,
986+ specific_packages : Optional [List [str ]] = None ,
987+ sync_simple_index : bool = True ,
983988) -> int :
984989 config_values = validate_config_values (config )
985990
@@ -1046,7 +1051,9 @@ async def mirror(
10461051 download_mirror = config_values .download_mirror ,
10471052 download_mirror_no_fallback = config_values .download_mirror_no_fallback ,
10481053 )
1049- changed_packages = await mirror .synchronize (specific_packages )
1054+ changed_packages = await mirror .synchronize (
1055+ specific_packages , sync_simple_index = sync_simple_index
1056+ )
10501057
10511058 logger .info (f"{ len (changed_packages )} packages had changes" )
10521059 for package_name , changes in changed_packages .items ():
0 commit comments