Skip to content

Commit

Permalink
Fix issue #2630 (#2631)
Browse files Browse the repository at this point in the history
* Fix issue #2630
  • Loading branch information
Neizvestnyj authored Jul 9, 2022
1 parent 1f7f892 commit 6fa6dde
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pythonforandroid/recipes/tflite-runtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from pythonforandroid.recipe import PythonRecipe, current_directory,\
from pythonforandroid.recipe import PythonRecipe, current_directory, \
shprint, info_main, warning
from pythonforandroid.logger import error
from os.path import join
import sh


class TFLiteRuntimeRecipe(PythonRecipe):

###############################################################
#
# tflite-runtime README:
Expand All @@ -31,6 +30,15 @@ class TFLiteRuntimeRecipe(PythonRecipe):
site_packages_name = 'tflite-runtime'
call_hostpython_via_targetpython = False

def should_build(self, arch):
name = self.folder_name.replace('-', '_')

if self.ctx.has_package(name, arch):
info_main('Python package already exists in site-packages')
return False
info_main('{} apparently isn\'t already in site-packages'.format(name))
return True

def build_arch(self, arch):
if arch.arch == 'x86_64':
warning("******** tflite-runtime x86_64 will not be built *******")
Expand All @@ -54,9 +62,9 @@ def build_arch(self, arch):
pybind11_include_dir = pybind11_recipe.get_include_dir(arch)
numpy_include_dir = join(self.ctx.get_site_packages_dir(arch),
'numpy', 'core', 'include')
includes = ' -I' + python_include_dir +\
' -I' + numpy_include_dir +\
' -I' + pybind11_include_dir
includes = ' -I' + python_include_dir + \
' -I' + numpy_include_dir + \
' -I' + pybind11_include_dir

# Scripts
build_script = join(script_dir, 'build_pip_package_with_cmake.sh')
Expand Down

0 comments on commit 6fa6dde

Please sign in to comment.