8000 Merge branch 'master' of https://github.com/KeyWeeUsr/python-for-andr… · Rootex/python-for-android@851fafb · GitHub
[go: up one dir, main page]

Skip to content

Commit 851fafb

Browse files
committed
Merge branch 'master' of https://github.com/KeyWeeUsr/python-for-android into KeyWeeUsr-master
2 parents 7f0b305 + c0ed84d commit 851fafb

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

pythonforandroid/toolchain.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,12 @@ def add_parser(subparsers, *args, **kwargs):
372372
parents=[generic_parser])
373373
parser_clean_recipe_build.add_argument('recipe', help='The recipe name')
374374

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'],
377377
help='Delete any cached recipe downloads',
378378
parents=[generic_parser])
379+
parser_clean_download_cache.add_argument('recipe',
380+
help='The recipe name')
379381

380382
parser_export_dist = add_parser(subparsers,
381383
'export_dist', aliases=['export-dist'],
@@ -587,13 +589,29 @@ def clean_recipe_build(self, args):
587589

588590
def clean_download_cache(self, args):
589591
'''
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
591596
592597
This does *not* delete the build caches or final distributions.
593598
'''
594599
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))
597615

598616
@require_prebuilt_dist
599617
def export_dist(self, args):

0 commit comments

Comments
 (0)
0