kivy-ios/recipes/host_setuptools/__init__.py

49 lines
1.7 KiB
Python
Raw Normal View History

from toolchain import Recipe, shprint
from os.path import join, exists
import sh
import os
import fnmatch
import shutil
2019-08-12 15:43:41 +01:00
class HostSetuptoolsRecipe(Recipe):
depends = ["openssl", "hostpython3"]
name = "setuptools"
2016-02-14 14:49:25 +01:00
archs = ["x86_64"]
2019-08-12 15:43:41 +01:00
version = "41.0.1"
url = "https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip"
cythonize = False
'''
def prebuild_arch(self, arch):
2019-08-12 15:43:41 +01:00
hostpython = sh.Command(self.ctx.hostpython)
sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
shprint(hostpython, "./ez_setup.py")
# Extract setuptools egg and remove .pth files. Otherwise subsequent
# python package installations using setuptools will raise exceptions.
# Setuptools version 28.3.0
site_packages_path = join(
2019-08-12 15:43:41 +01:00
self.ctx.dist_dir, 'hostpython3',
'lib', 'python3.7', 'site-packages')
os.chdir(site_packages_path)
with open('setuptools.pth', 'r') as f:
setuptools_egg_path = f.read().strip('./').strip('\n')
unzip = sh.Command('unzip')
2019-08-12 15:43:41 +01:00
shprint(unzip, '-o', setuptools_egg_path)
os.remove(setuptools_egg_path)
os.remove('setuptools.pth')
os.remove('easy-install.pth')
shutil.rmtree('EGG-INFO')
2019-08-12 15:43:41 +01:00
'''
def install(self):
import sh
from toolchain import shprint
from os import chdir
arch = self.filtered_archs[0]
build_dir = self.get_build_dir(arch.arch)
chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
2019-08-12 15:43:41 +01:00
shprint(hostpython, "setup.py", "install", "--prefix", "{}/hostpython3".format(self.ctx.dist_dir))
2019-08-12 15:43:41 +01:00
recipe = HostSetuptoolsRecipe()