From 57e6181912c0721113b96fc0472117a94695c453 Mon Sep 17 00:00:00 2001 From: Richard Larkin Date: Wed, 1 Jul 2020 22:06:45 +0200 Subject: [PATCH] :sparkles: Remove compile kruft after build. closes #315 (#523) Co-authored-by: richard --- kivy_ios/toolchain.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/kivy_ios/toolchain.py b/kivy_ios/toolchain.py index 9727a3c0..67ee2a78 100755 --- a/kivy_ios/toolchain.py +++ b/kivy_ios/toolchain.py @@ -87,6 +87,16 @@ def _cache_execution(self, *args, **kwargs): return _cache_execution +def remove_junk(d): + """ Remove unused build artifacts. """ + exts = (".so.lib", ".so.o", ".sh") + for root, dirnames, filenames in walk(d): + for fn in filenames: + if fn.endswith(exts): + print('Found junk {}/{}, removing'.format(root, fn)) + unlink(join(root, fn)) + + class ChromeDownloader(FancyURLopener): version = ( 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 ' @@ -838,6 +848,7 @@ def postbuild_arch(self, arch): logger.debug("Invoking {}".format(postbuild)) if hasattr(self, postbuild): getattr(self, postbuild)() + remove_junk(self.build_dir) def update_state(self, key, value): """ @@ -995,16 +1006,7 @@ class PythonRecipe(Recipe): def install(self): self.install_python_package() self.reduce_python_package() - self.remove_junk(self.ctx.site_packages_dir) - - @staticmethod - def remove_junk(d): - exts = (".so.lib", ".so.o", ".sh") - for root, dirnames, filenames in walk(d): - for fn in filenames: - if fn.endswith(exts): - print('Found junk {}/{}, removing'.format(root, fn)) - unlink(join(root, fn)) + remove_junk(self.ctx.site_packages_dir) def install_python_package(self, name=None, env=None, is_dir=True): """Automate the installation of a Python package into the target