8000 Fixed recipe deletion for PythonRecipes · mixedCase/python-for-android@050bbac · GitHub
[go: up one dir, main page]

Skip to content

Commit 050bbac

Browse files
committed
Fixed recipe deletion for PythonRecipes
1 parent d3930b6 commit 050bbac

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pythonforandroid/recipe.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import importlib
33
import zipfile
44
import glob
5+
from shutil import rmtree
56
from six import PY2, with_metaclass
67

78
import sh
@@ -714,6 +715,21 @@ class PythonRecipe(Recipe):
714715
setup_extra_args = []
715716
'''List of extra arugments to pass to setup.py'''
716717

718+
def clean_build(self, arch=None):
719+
super(PythonRecipe, self).clean_build(arch=arch)
720+
name = self.site_packages_name
721+
if name is None:
722+
name = self.name
723+
python_install_dirs = glob.glob(join(self.ctx.python_installs_dir, '*'))
724+
for python_install in python_install_dirs:
725+
site_packages_dir = glob.glob(join(python_install, 'lib', 'python*',
726+
'site-packages'))
727+
if site_packages_dir:
728+
build_dir = join(site_packages_dir[0], name)
729+
if exists(build_dir):
730+
info('Deleted {}'.format(build_dir))
731+
rmtree(build_dir)
732+
717733
@property
718734
def real_hostpython_location(self):
719735
if 'hostpython2' in self.ctx.recipe_build_order:

0 commit comments

Comments
 (0)
0