@@ -372,10 +372,14 @@ def add_parser(subparsers, *args, **kwargs):
372
372
parents = [generic_parser ])
373
373
parser_clean_recipe_build .add_argument ('recipe' , help = 'The recipe name' )
374
374
375
- parser_clear_download_cache = add_parser (subparsers ,
376
- 'clear_download_cache ' , aliases = ['clear -download-cache' ],
377
- help = 'Delete any cached recipe downloads' ,
375
+ parser_clean_download_cache = add_parser (subparsers ,
376
+ 'clean_download_cache ' , aliases = ['clean -download-cache' ],
377
+ help = 'Delete cached downloads for requirement builds ' ,
378
378
parents = [generic_parser ])
379
+ parser_clean_download_cache .add_argument (
380
+ 'recipes' , nargs = '*' ,
381
+ help = ('The recipes to clean (space-separated). If no recipe name is '
382
+ 'provided, the entire cache is cleared.' ))
379
383
380
384
parser_export_dist = add_parser (subparsers ,
381
385
'export_dist' , aliases = ['export-dist' ],
@@ -587,13 +591,28 @@ def clean_recipe_build(self, args):
587
591
588
592
def clean_download_cache (self , args ):
589
593
'''
590
- Deletes any downloaded recipe packages.
594
+ Deletes a download cache for recipes stated as arguments. If no
595
+ argument is passed, it'll delete *all* downloaded cache. ::
596
+
597
+ p4a clean_download_cache kivy,pyjnius
591
598
592
599
This does *not* delete the build caches or final distributions.
593
600
'''
594
601
ctx = self .ctx
595
- if exists (ctx .packages_path ):
596
- shutil .rmtree (ctx .packages_path )
602
+ if args .recipes :
603
+ for package in args .recipes :
604
+ remove_path = join (ctx .packages_path , package )
605
+ if exists (remove_path ):
606
+ shutil .rmtree (remove_path )
607
+ info ('Download cache removed for: "{}"' .format (package ))
608
+ else :
609
+ warning ('No download cache found for "{}", skipping' .format (package ))
610
+ else :
611
+ if exists (ctx .packages_path ):
612
+ shutil .rmtree (ctx .packages_path )
613
+ info ('Download cache removed.' )
614
+ else :
615
+ print ('No cache found at "{}"' .format (ctx .packages_path ))
597
616
598
617
@require_prebuilt_dist
599
618
def export_dist (self , args ):
0 commit comments