Skip to content

Commit 91c318e

Browse files
committed
Improved clean_download_cache argument handling
1 parent 851fafb commit 91c318e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

pythonforandroid/toolchain.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,12 @@ def add_parser(subparsers, *args, **kwargs):
374374

375375
parser_clean_download_cache= add_parser(subparsers,
376376
'clean_download_cache', aliases=['clean-download-cache'],
377-
help='Delete any cached recipe downloads',
377+
help='Delete cached downloads for requirement builds',
378378
parents=[generic_parser])
379-
parser_clean_download_cache.add_argument('recipe',
380-
help='The recipe name')
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.'))
381383

382384
parser_export_dist = add_parser(subparsers,
383385
'export_dist', aliases=['export-dist'],
@@ -597,21 +599,20 @@ def clean_download_cache(self, args):
597599
This does *not* delete the build caches or final distributions.
598600
'''
599601
ctx = self.ctx
600-
msg = "Download cache removed!"
601-
if args.recipe:
602-
for package in args.recipe.split(','):
602+
if args.recipes:
603+
for package in args.recipes:
603604
remove_path = join(ctx.packages_path, package)
604605
if exists(remove_path):
605606
shutil.rmtree(remove_path)
606-
print(msg[:-1] + ' for: "{}"!'.format(package))
607+
info('Download cache removed for: "{}"'.format(package))
607608
else:
608-
print('No download cache for "{}" found!'.format(package))
609+
warning('No download cache found for "{}", skipping'.format(package))
609610
else:
610611
if exists(ctx.packages_path):
611612
shutil.rmtree(ctx.packages_path)
612-
print(msg)
613+
info('Download cache removed.')
613614
else:
614-
print('Nothing found at "{}"'.format(ctx.packages_path))
615+
print('No cache found at "{}"'.format(ctx.packages_path))
615616

616617
@require_prebuilt_dist
617618
def export_dist(self, args):

0 commit comments

Comments
 (0)