@@ -372,10 +372,12 @@ 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' ],
375
+ parser_clean_download_cache = add_parser (subparsers ,
376
+ 'clean_download_cache ' , aliases = ['clean -download-cache' ],
377
377
help = 'Delete any cached recipe downloads' ,
378
378
parents = [generic_parser ])
379
+ parser_clean_download_cache .add_argument ('recipe' ,
380
+ help = 'The recipe name' )
379
381
380
382
parser_export_dist = add_parser (subparsers ,
381
383
'export_dist' , aliases = ['export-dist' ],
@@ -587,13 +589,29 @@ def clean_recipe_build(self, args):
587
589
588
590
def clean_download_cache (self , args ):
589
591
'''
590
- Deletes any downloaded recipe packages.
592
+ Deletes a download cache for recipes stated as arguments. If no
593
+ argument is passed, it'll delete *all* downloaded cache. ::
594
+
595
+ p4a clean_download_cache kivy,pyjnius
591
596
592
597
This does *not* delete the build caches or final distributions.
593
598
'''
594
599
ctx = self .ctx
595
- if exists (ctx .packages_path ):
596
- shutil .rmtree (ctx .packages_path )
600
+ msg = "Download cache removed!"
601
+ if args .recipe :
602
+ for package in args .recipe .split (',' ):
603
+ remove_path = join (ctx .packages_path , package )
604
+ if exists (remove_path ):
605
+ shutil .rmtree (remove_path )
606
+ print (msg [:- 1 ] + ' for: "{}"!' .format (package ))
607
+ else :
608
+ print ('No download cache for "{}" found!' .format (package ))
609
+ else :
610
+ if exists (ctx .packages_path ):
611
+ shutil .rmtree (ctx .packages_path )
612
+ print (msg )
613
+ else :
614
+ print ('Nothing found at "{}"' .format (ctx .packages_path ))
597
615
598
616
@require_prebuilt_dist
599
617
def export_dist (self , args ):
0 commit comments