Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions pythonforandroid/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,12 @@ def add_parser(subparsers, *args, **kwargs):
parents=[generic_parser])
parser_clean_recipe_build.add_argument('recipe', help='The recipe name')

parser_clear_download_cache= add_parser(subparsers,
'clear_download_cache', aliases=['clear-download-cache'],
parser_clean_download_cache= add_parser(subparsers,
'clean_download_cache', aliases=['clean-download-cache'],
help='Delete any cached recipe downloads',
parents=[generic_parser])
parser_clean_download_cache.add_argument('recipe',
help='The recipe name')

parser_export_dist = add_parser(subparsers,
'export_dist', aliases=['export-dist'],
Expand Down Expand Up @@ -578,13 +580,29 @@ def clean_recipe_build(self, args):

def clean_download_cache(self, args):
'''
Deletes any downloaded recipe packages.
Deletes a download cache for recipes stated as arguments. If no
argument is passed, it'll delete *all* downloaded cache. ::

p4a clean_download_cache kivy,pyjnius

This does *not* delete the build caches or final distributions.
'''
ctx = self.ctx
if exists(ctx.packages_path):
shutil.rmtree(ctx.packages_path)
msg = "Download cache removed!"
if args.recipe:
for package in args.recipe.split(','):
remove_path = join(ctx.packages_path, package)
if exists(remove_path):
shutil.rmtree(remove_path)
print(msg[:-1] + ' for: "{}"!'.format(package))
else:
print('No download cache for "{}" found!'.format(package))
else:
if exists(ctx.packages_path):
shutil.rmtree(ctx.packages_path)
print(msg)
else:
print('Nothing found at "{}"'.format(ctx.packages_path))

@require_prebuilt_dist
def export_dist(self, args):
Expand Down