Skip to content

Commit 6a17464

Browse files
committed
[dist] Remove ctx's library on clean_build
In case that we detect that the recipe it's a library recipe
1 parent 479e71e commit 6a17464

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pythonforandroid/recipe.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,10 @@ def clean_build(self, arch=None):
622622
base_dir = join(
623623
self.ctx.build_dir, 'other_builds', self.get_dir_name()
624624
)
625+
archs = [arch.arch for arch in self.ctx.archs]
625626
else:
626627
base_dir = self.get_build_container_dir(arch)
628+
archs = [arch.arch]
627629
dirs = glob.glob(base_dir + '-*')
628630
if exists(base_dir):
629631
dirs.append(base_dir)
@@ -640,6 +642,15 @@ def clean_build(self, arch=None):
640642
# doesn't persist in site-packages
641643
shutil.rmtree(self.ctx.python_installs_dir)
642644

645+
if self.built_libraries:
646+
for arch in archs:
647+
for lib in self.get_recipe_libraries(arch, in_context=True):
648+
if isfile(lib):
649+
info('Deleting ctx {arch} library {lib}'.format(
650+
arch=arch, lib=split(lib)[-1])
651+
)
652+
shprint(sh.rm, '-f', lib)
653+
643654
def install_libs(self, arch, *libs):
644655
libs_dir = self.ctx.get_libs_dir(arch.arch)
645656
if not libs:

0 commit comments

Comments
 (0)