lbry-android/recipes/pyjnius/__init__.py
Akinwale Ariwodola e08f6ee73c
add / update recipes and build changes for Python 3.6.6 compatibility (#315)
* add / update recipes and build changes for Python 3.6.6 compatibility
* include Python 3 apt packages in travis build script
* use Python 3.6 in Travis
* Enable _blake2 and _sha3 in Python 3. Remove unnecessary files.
* change zope.interface version
* update cffi version
2018-10-07 15:59:03 +01:00

35 lines
1.4 KiB
Python

from pythonforandroid.toolchain import CythonRecipe, Recipe, shprint, current_directory, info
from pythonforandroid.patching import will_build, check_any
import sh
from os.path import join
class PyjniusRecipe(CythonRecipe):
version = 'master'
url = 'https://github.com/kivy/pyjnius/archive/{version}.zip'
name = 'pyjnius'
depends = [('python2', 'python3crystax'), 'genericndkbuild', 'six']
site_packages_name = 'jnius'
call_hostpython_via_targetpython = False
patches = [('sdl2_jnienv_getter.patch', will_build('sdl2')),
('genericndkbuild_jnienv_getter.patch', will_build('genericndkbuild'))]
def get_recipe_env(self, arch):
env = super(PyjniusRecipe, self).get_recipe_env(arch)
target_python = Recipe.get_recipe('python3crystax', self.ctx).get_build_dir(arch.arch)
env['PYTHON_ROOT'] = join(target_python, 'python-install')
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.6'
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython3.6m'
return env
def postbuild_arch(self, arch):
super(PyjniusRecipe, self).postbuild_arch(arch)
info('Copying pyjnius java class to classes build dir')
with current_directory(self.get_build_dir(arch.arch)):
shprint(sh.cp, '-a', join('jnius', 'src', 'org'), self.ctx.javaclass_dir)
recipe = PyjniusRecipe()