diff --git a/recipes/kivy/__init__.py b/recipes/kivy/__init__.py index c60ed76..97d2fc9 100644 --- a/recipes/kivy/__init__.py +++ b/recipes/kivy/__init__.py @@ -3,6 +3,7 @@ from os.path import join from os import chdir, listdir, getcwd import sh import logging +import shutil logger = logging.getLogger(__name__) @@ -43,55 +44,10 @@ class KivyRecipe(CythonRecipe): with open(pyconfig, "w") as fd: fd.writelines(lines) - def install_python_package(self, name=None, env=None, is_dir=True): - """ - Automate the installation of a Python package into the target - site-packages. - """ - arch = self.filtered_archs[0] - if name is None: - name = self.name - if env is None: - env = self.get_recipe_env(arch) - print("Install {} into the site-packages".format(name)) - build_dir = self.get_build_dir(arch.arch) - chdir(build_dir) - - hostpython = sh.Command(self.ctx.hostpython) - env["PYTHONPATH"] = self.ctx.site_packages_dir - shprint( - hostpython, - "setup.py", - "bdist_egg", - "--exclude-source-files", - "--plat-name=", - # "--plat-name={}".format(arch.arch), - _env=env, - ) - for file in listdir("./dist"): - if file.endswith(".egg"): - egg_name = file - shprint( - hostpython, - "setup.py", - "easy_install", - "--no-deps", - "--install-dir", - self.ctx.site_packages_dir, - join("dist", egg_name), - _env=env, - ) - - # clean - oldpwd = getcwd() - try: - logger.info("Remove files unlikely to be used") - chdir(join(self.ctx.site_packages_dir, egg_name)) - sh.rm("-rf", "share") - sh.rm("-rf", "kivy/tools") - sh.rm("-rf", "kivy/tests") - finally: - chdir(oldpwd) + def reduce_python_package(self): + dest_dir = join(self.ctx.site_packages_dir, "kivy") + shutil.rmtree(join(dest_dir, "tools")) + shutil.rmtree(join(dest_dir, "tests")) recipe = KivyRecipe() diff --git a/toolchain.py b/toolchain.py index 6d0b4c6..65e95c2 100755 --- a/toolchain.py +++ b/toolchain.py @@ -1043,21 +1043,16 @@ class PythonRecipe(Recipe): build_dir = self.get_build_dir(arch.arch) chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) - iosbuild = join(build_dir, "iosbuild") - shprint(hostpython, "setup.py", "install", "-O2", - "--prefix", iosbuild, - _env=env) - dest_dir = join(self.ctx.site_packages_dir, name) - if is_dir: - if exists(dest_dir): - shutil.rmtree(dest_dir) - func = shutil.copytree - else: - func = shutil.copy - func( - join(iosbuild, "lib", - self.ctx.python_ver_dir, "site-packages", name), - dest_dir) + + shprint( + hostpython, + "setup.py", + "install", + "-O2", + "--root", self.ctx.python_prefix, + "--prefix", "", + _env=env, + ) def reduce_python_package(self): """Feel free to remove things you don't want in the final