Skip to content

Commit

Permalink
✨ Remove compile kruft after build. closes #315 (#523)
Browse files Browse the repository at this point in the history
Co-authored-by: richard <richard@dotmodus>
  • Loading branch information
Zen-CODE and richard committed Jul 1, 2020
1 parent 319e7cc commit 57e6181
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions kivy_ios/toolchain.py
Expand Up @@ -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 '
Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 57e6181

Please sign in to comment.