2018-10-28 19:20:40 +01:00
|
|
|
from pythonforandroid.recipe import CythonRecipe
|
|
|
|
from pythonforandroid.toolchain import shprint, current_directory, info
|
|
|
|
from pythonforandroid.patching import will_build
|
2017-08-13 03:24:00 +02:00
|
|
|
import sh
|
|
|
|
from os.path import join
|
|
|
|
|
|
|
|
|
|
|
|
class PyjniusRecipe(CythonRecipe):
|
2019-03-30 21:58:45 +01:00
|
|
|
# "6553ad4" is one commit after last release (1.2.0)
|
|
|
|
# it fixes method resolution, required for resolving requestPermissions()
|
|
|
|
version = '6553ad4'
|
2017-08-13 03:24:00 +02:00
|
|
|
url = 'https://github.com/kivy/pyjnius/archive/{version}.zip'
|
|
|
|
name = 'pyjnius'
|
2019-03-30 21:58:45 +01:00
|
|
|
depends = [('genericndkbuild', 'sdl2', 'sdl'), 'six']
|
2017-08-13 03:24:00 +02:00
|
|
|
site_packages_name = 'jnius'
|
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
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)
|
|
|
|
|
|
|
|
return env
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
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()
|