@@ -314,13 +314,11 @@ def parse_denylist(filename: Path) -> List[str]:
314314 return [entry for line in handle .readlines () if (entry := line .strip ())]
315315
316316
317- def generate_build_script (filename : Path , images : List [str ], template : Path ) -> None :
317+ def generate_build_script (filename : Path , images : List [str ]) -> None :
318318 """Generate a build script from provided templates."""
319- with template .open () as handle :
320- img_template = Template (handle .read ())
321319 with filename .open ("a" ) as handle :
322320 for idx , img in enumerate (images , start = 1 ):
323- handle .write (img_template . substitute ( img = img , idx = idx , total = len (images )) )
321+ handle .write (f" \n build_singularity_image { img } { idx } { len (images )} \n " )
324322
325323
326324def parse_args (argv : Optional [List [str ]] = None ) -> argparse .Namespace :
@@ -346,15 +344,6 @@ def parse_args(argv: Optional[List[str]] = None) -> argparse.Namespace:
346344 type = Path ,
347345 help = f"Output the Singularity build script (default '{ default_build_script } ')." ,
348346 )
349- default_image_template = Path ("image_template.sh" )
350- parser .add_argument (
351- "--image-template" ,
352- metavar = "PATH" ,
353- default = default_image_template ,
354- type = Path ,
355- help = f"The template for building a single Singularity image (default "
356- f"'{ default_image_template } '). Uses Python `string.Template` syntax." ,
357- )
358347 default_quay_api = "https://quay.io/api/v1/"
359348 parser .add_argument (
360349 "--quay-api" ,
@@ -395,7 +384,6 @@ def main(argv: Optional[List[str]] = None) -> None:
395384 )
396385 assert args .denylist .is_file (), f"File not found '{ args .denylist } '."
397386 assert args .build_script .is_file (), f"File not found '{ args .build_script } '."
398- assert args .image_template .is_file (), f"File not found '{ args .image_template } '."
399387 args .build_script .parent .mkdir (parents = True , exist_ok = True )
400388 logger .info ("Fetching quay.io BioContainers images." )
401389 quay_images = asyncio .run (QuayImageFetcher .fetch_all (api_url = args .quay_api ))
@@ -412,7 +400,7 @@ def main(argv: Optional[List[str]] = None) -> None:
412400 logger .warning ("No new images found." )
413401 return
414402 logger .info (f"{ len (images ):,} new images found. Generating build script." )
415- generate_build_script (args .build_script , images , args . image_template )
403+ generate_build_script (args .build_script , images )
416404
417405
418406if __name__ == "__main__" :
0 commit comments