From d0ba2dd4dd7adbbf1687135eac08b429100774d1 Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Fri, 14 Oct 2016 16:01:50 +0200 Subject: [PATCH] fix host_setuptools recipe --- recipes/cryptography/__init__.py | 6 ++++++ recipes/host_setuptools/__init__.py | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/recipes/cryptography/__init__.py b/recipes/cryptography/__init__.py index 51c5b14..8182e7e 100644 --- a/recipes/cryptography/__init__.py +++ b/recipes/cryptography/__init__.py @@ -1,3 +1,4 @@ +from os.path import join from toolchain import CythonRecipe @@ -12,5 +13,10 @@ class CryptographyRecipe(CythonRecipe): depends = ["host_setuptools", "six", "idna", "pyasn1"] cythonize = False + def get_recipe_env(self, arch): + env = super(CryptographyRecipe, self).get_recipe_env(arch) + env["CC"] += " -I{}".format( + join(self.ctx.dist_dir, "include", arch.arch, "libffi")) + return env recipe = CryptographyRecipe() diff --git a/recipes/host_setuptools/__init__.py b/recipes/host_setuptools/__init__.py index b71ac26..5ee6056 100644 --- a/recipes/host_setuptools/__init__.py +++ b/recipes/host_setuptools/__init__.py @@ -14,8 +14,21 @@ class HostSetuptools(Recipe): def prebuild_arch(self, arch): hostpython = sh.Command(self.ctx.hostpython) sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py") - # Installed setuptools egg should be extracted in hostpython - # site-packages(v28.3.0) 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', 'python2.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()