Merge pull request #214 from rnixx/fix_host_setuptools
Fix host setuptools
This commit is contained in:
commit
01a0c6a751
4 changed files with 30 additions and 19 deletions
|
@ -7,27 +7,28 @@ import shutil
|
|||
|
||||
|
||||
class HostSetuptools(Recipe):
|
||||
depends = ["hostpython"]
|
||||
depends = ["openssl", "hostpython"]
|
||||
archs = ["x86_64"]
|
||||
url = ""
|
||||
url = "setuptools"
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env = arch.get_env()
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
# shprint(hostpython, "./ez_setup.py", "--to-dir", dest_dir)
|
||||
shprint(hostpython, "./ez_setup.py", _env=build_env)
|
||||
|
||||
# def install(self):
|
||||
# arch = list(self.filtered_archs)[0]
|
||||
# build_dir = self.get_build_dir(arch.arch)
|
||||
# os.chdir(build_dir)
|
||||
# hostpython = sh.Command(self.ctx.hostpython)
|
||||
# build_env = arch.get_env()
|
||||
# dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
# build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
# shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||
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()
|
||||
|
|
1
recipes/host_setuptools/setuptools/README.rst
Normal file
1
recipes/host_setuptools/setuptools/README.rst
Normal file
|
@ -0,0 +1 @@
|
|||
Make toolchain happy
|
1
recipes/hostpython/ModulesSetup.openssl
Normal file
1
recipes/hostpython/ModulesSetup.openssl
Normal file
|
@ -0,0 +1 @@
|
|||
_ssl _ssl.c -DUSE_SSL -lssl -lcrypto
|
|
@ -8,7 +8,8 @@ import shutil
|
|||
class HostpythonRecipe(Recipe):
|
||||
version = "2.7.1"
|
||||
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2"
|
||||
depends = ["hostlibffi", ]
|
||||
depends = ["hostlibffi"]
|
||||
optional_depends = ["openssl"]
|
||||
archs = ["x86_64"]
|
||||
|
||||
def init_with_ctx(self, ctx):
|
||||
|
@ -19,13 +20,15 @@ class HostpythonRecipe(Recipe):
|
|||
print("Global: hostpgen located at {}".format(self.ctx.hostpgen))
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
if self.has_marker("patched"):
|
||||
if self.has_marker("patched"):
|
||||
return
|
||||
self.copy_file("_scproxy.py", "Lib/_scproxy.py")
|
||||
self.apply_patch("ssize-t-max.patch")
|
||||
self.apply_patch("dynload.patch")
|
||||
self.apply_patch("static-_sqlite3.patch")
|
||||
self.copy_file("ModulesSetup", "Modules/Setup.local")
|
||||
if "openssl.build_all" in self.ctx.state:
|
||||
self.append_file("ModulesSetup.openssl", "Modules/Setup.local")
|
||||
self.set_marker("patched")
|
||||
|
||||
def postbuild_arch(self, arch):
|
||||
|
@ -59,6 +62,11 @@ class HostpythonRecipe(Recipe):
|
|||
"--sysroot={}".format(sdk_path),
|
||||
"-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include"))
|
||||
])
|
||||
|
||||
if "openssl.build_all" in self.ctx.state:
|
||||
build_env["CFLAGS"] += " -I{}".format(join(self.ctx.dist_dir, "include",
|
||||
"x86_64", "openssl"))
|
||||
|
||||
configure = sh.Command(join(self.build_dir, "configure"))
|
||||
shprint(configure,
|
||||
"--prefix={}".format(join(self.ctx.dist_dir, "hostpython")),
|
||||
|
|
Loading…
Reference in a new issue