2019-03-30 21:58:45 +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):
|
2022-12-02 21:15:34 +01:00
|
|
|
version = '1.4.2'
|
2017-08-13 03:24:00 +02:00
|
|
|
url = 'https://github.com/kivy/pyjnius/archive/{version}.zip'
|
|
|
|
name = 'pyjnius'
|
2022-12-02 21:15:34 +01:00
|
|
|
depends = [('genericndkbuild', 'sdl2'), 'six']
|
2017-08-13 03:24:00 +02:00
|
|
|
site_packages_name = 'jnius'
|
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
patches = [('genericndkbuild_jnienv_getter.patch', will_build('genericndkbuild'))]
|
|
|
|
|
|
|
|
def get_recipe_env(self, arch):
|
|
|
|
env = super().get_recipe_env(arch)
|
|
|
|
# NDKPLATFORM is our switch for detecting Android platform, so can't be None
|
|
|
|
env['NDKPLATFORM'] = "NOTNONE"
|
|
|
|
return env
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
def postbuild_arch(self, arch):
|
2022-12-02 21:15:34 +01:00
|
|
|
super().postbuild_arch(arch)
|
2017-08-13 03:24:00 +02:00
|
|
|
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()
|