kivy-ios/kivy_ios/recipes/host_setuptools/__init__.py
Andre Miras e29d6aa256 Removed Python 2 support
Drops system, host and target Python 2 support.
Note a lot of recipes were having hardcoded reference to
`lib/python2.7/site-packages/` directory. I suspect most
of theses were not working, but the reference has been updated
to `lib/python3.7/site-packages/` following the same hardcoding
pattern. In follow up work we would do a walkthrough each recipes
to fix at least compilation time issues.
Also note the `rebuild_updated_recipes.py` is expected to fail as
this is touching many recipes including recipes that were already
broken.
2020-05-06 15:46:34 +02:00

34 lines
1.1 KiB
Python

from kivy_ios.toolchain import Recipe, shprint
from os.path import join
import sh
import os
import shutil
class HostSetuptools(Recipe):
depends = ["openssl", "hostpython"]
archs = ["x86_64"]
url = "setuptools"
def prebuild_arch(self, arch):
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(
self.ctx.dist_dir, 'hostpython',
'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')
shprint(unzip, setuptools_egg_path)
os.remove(setuptools_egg_path)
os.remove('setuptools.pth')
os.remove('easy-install.pth')
shutil.rmtree('EGG-INFO')
recipe = HostSetuptools()