lbry-fdroid/p4a/pythonforandroid/recipes/pyzmq/__init__.py
Akinwale Ariwodola 8b2694efb7
New build (#508)
* fix build for openssl 1.1.1b required for sdk
(cherry picked from commit aa49e3b2755b97b6331cdbbb89efc954de8d5977)

* use js code from master

* fix openssl recipe and tweak build
(cherry picked from commit 6e94c27021c7bd7b1e880c2fc314850e36a5a38e)

* remove unused build recipes
(cherry picked from commit f5c0577bdb175bfc0990602936bbc9e2052e1f25)
2019-03-30 21:58:45 +01:00

59 lines
2.1 KiB
Python

# coding=utf-8
from pythonforandroid.recipe import CythonRecipe, Recipe
from os.path import join
from pythonforandroid.util import current_directory
import sh
from pythonforandroid.logger import shprint
import glob
class PyZMQRecipe(CythonRecipe):
name = 'pyzmq'
version = 'master'
url = 'https://github.com/zeromq/pyzmq/archive/{version}.zip'
site_packages_name = 'zmq'
depends = ['libzmq']
cython_args = ['-Izmq/utils',
'-Izmq/backend/cython',
'-Izmq/devices']
def get_recipe_env(self, arch=None):
env = super(PyZMQRecipe, self).get_recipe_env(arch)
# TODO: fix hardcoded path
# This is required to prevent issue with _io.so import.
# hostpython = self.get_recipe('hostpython2', self.ctx)
# env['PYTHONPATH'] = (
# join(hostpython.get_build_dir(arch.arch), 'build',
# 'lib.linux-x86_64-2.7') + ':' + env.get('PYTHONPATH', '')
# )
# env["LDSHARED"] = env["CC"] + ' -shared'
return env
def build_cython_components(self, arch):
libzmq_recipe = Recipe.get_recipe('libzmq', self.ctx)
libzmq_prefix = join(libzmq_recipe.get_build_dir(arch.arch), "install")
self.setup_extra_args = ["--zmq={}".format(libzmq_prefix)]
self.build_cmd = "configure"
env = self.get_recipe_env(arch)
setup_cfg = join(self.get_build_dir(arch.arch), "setup.cfg")
with open(setup_cfg, "wb") as fd:
fd.write("""
[global]
zmq_prefix = {}
skip_check_zmq = True
""".format(libzmq_prefix))
return super(PyZMQRecipe, self).build_cython_components(arch)
with current_directory(self.get_build_dir(arch.arch)):
hostpython = sh.Command(self.hostpython_location)
shprint(hostpython, 'setup.py', 'configure', '-v', _env=env)
shprint(hostpython, 'setup.py', 'build_ext', '-v', _env=env)
build_dir = glob.glob('build/lib.*')[0]
shprint(sh.find, build_dir, '-name', '"*.o"', '-exec',
env['STRIP'], '{}', ';', _env=env)
recipe = PyZMQRecipe()