kivy-ios/recipes/host_setuptools3/__init__.py
Richard Larkin 8416d46fd4
Fix flake8 CI check on toolchain, remaining recipes (#456)
* 🔥 Fix flake8 checks for host_setuptools3

* 🔥 Fix flake8 checks for kivy recipe

*  Fix flake8 for toolchain.py

* 💡 Set python3 as the default python

* Add .tox and ven to .gitignore

* Update toolchain.py

Co-Authored-By: Andre Miras <AndreMiras@users.noreply.github.com>

Co-authored-by: Andre Miras <AndreMiras@users.noreply.github.com>
2020-04-27 07:29:11 +02:00

35 lines
1.2 KiB
Python

from toolchain import Recipe, shprint
from os.path import join
import sh
import os
import shutil
class HostSetuptools3(Recipe):
depends = ["openssl", "hostpython3"]
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, 'hostpython3',
'lib', 'python3.8', 'site-packages')
os.chdir(site_packages_path)
with open('setuptools.pth', 'r') as f:
setuptools_egg_path = f.read().strip('./').strip('\n')
print("setuptools_egg_path=", setuptools_egg_path)
unzip = sh.Command('unzip')
shprint(unzip, "-o", setuptools_egg_path)
os.remove(setuptools_egg_path)
os.remove('setuptools.pth')
os.remove('easy-install.pth')
shutil.rmtree('EGG-INFO')
recipe = HostSetuptools3()