@@ -364,8 +364,8 @@ def add_parser(subparsers, *args, **kwargs):
364
364
parents = [generic_parser ])
365
365
parser_clean_recipe_build .add_argument ('recipe' , help = 'The recipe name' )
366
366
367
- parser_clear_download_cache = add_parser (subparsers ,
368
- 'clear_download_cache ' , aliases = ['clear -download-cache' ],
367
+ parser_clean_download_cache = add_parser (subparsers ,
368
+ 'clean_download_cache ' , aliases = ['clean -download-cache' ],
369
369
help = 'Delete any cached recipe downloads' ,
370
370
parents = [generic_parser ])
371
371
@@ -578,13 +578,30 @@ def clean_recipe_build(self, args):
578
578
579
579
def clean_download_cache (self , args ):
580
580
'''
581
- Deletes any downloaded recipe packages.
581
+ Deletes a download cache for recipes stated as arguments. If no
582
+ argument is passed, it'll delete *all* downloaded cache. ::
583
+
584
+ p4a clean_download_cache kivy,pyjnius
582
585
583
586
This does *not* delete the build caches or final distributions.
584
587
'''
585
588
ctx = self .ctx
586
- if exists (ctx .packages_path ):
587
- shutil .rmtree (ctx .packages_path )
589
+ msg = "Download cache removed!"
590
+
591
+ if args .unknown_args :
592
+ for package in args .unknown_args [0 ].split (',' ):
593
+ remove_path = join (ctx .packages_path , package )
594
+ if exists (remove_path ):
595
+ shutil .rmtree (remove_path )
596
+ print (msg [:- 1 ] + ' for: "{}"!' .format (package ))
597
+ else :
598
+ print ('No download cache for "{}" found!' .format (package ))
599
+ else :
600
+ if exists (ctx .packages_path ):
601
+ shutil .rmtree (ctx .packages_path )
602
+ print (msg )
603
+ else :
604
+ print ('Nothing found at "{}"' .format (ctx .packages_path ))
588
605
589
606
@require_prebuilt_dist
590
607
def export_dist (self , args ):
0 commit comments