From 7961ab9ad56bf316083286c0444f97f7a3a330b0 Mon Sep 17 00:00:00 2001 From: Neizvestnyj Date: Thu, 30 Jun 2022 22:27:12 +0300 Subject: [PATCH 1/3] Fix issue #2630 --- pythonforandroid/recipes/tflite-runtime/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pythonforandroid/recipes/tflite-runtime/__init__.py b/pythonforandroid/recipes/tflite-runtime/__init__.py index 0627b7ae69..9cb3a2c0d9 100644 --- a/pythonforandroid/recipes/tflite-runtime/__init__.py +++ b/pythonforandroid/recipes/tflite-runtime/__init__.py @@ -30,6 +30,7 @@ class TFLiteRuntimeRecipe(PythonRecipe): patches = ['CMakeLists.patch', 'build_with_cmake.patch'] site_packages_name = 'tflite-runtime' call_hostpython_via_targetpython = False + install_in_hostpython = True def build_arch(self, arch): if arch.arch == 'x86_64': From 0a8debba07f9e6ce7193f824ef768e8bad2ecc7e Mon Sep 17 00:00:00 2001 From: Neizvestnyj Date: Tue, 5 Jul 2022 18:01:54 +0300 Subject: [PATCH 2/3] Fix issue #2630 --- pythonforandroid/recipes/tflite-runtime/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pythonforandroid/recipes/tflite-runtime/__init__.py b/pythonforandroid/recipes/tflite-runtime/__init__.py index 9cb3a2c0d9..6248c61cdf 100644 --- a/pythonforandroid/recipes/tflite-runtime/__init__.py +++ b/pythonforandroid/recipes/tflite-runtime/__init__.py @@ -30,7 +30,17 @@ class TFLiteRuntimeRecipe(PythonRecipe): patches = ['CMakeLists.patch', 'build_with_cmake.patch'] site_packages_name = 'tflite-runtime' call_hostpython_via_targetpython = False - install_in_hostpython = True + + 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': From 46325f3cd0db009167b3cf6d12143ede1734c00a Mon Sep 17 00:00:00 2001 From: Neizvestnyj Date: Wed, 6 Jul 2022 21:58:37 +0300 Subject: [PATCH 3/3] Fix issue #2630 --- .../recipes/tflite-runtime/__init__.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pythonforandroid/recipes/tflite-runtime/__init__.py b/pythonforandroid/recipes/tflite-runtime/__init__.py index 6248c61cdf..1d208866c2 100644 --- a/pythonforandroid/recipes/tflite-runtime/__init__.py +++ b/pythonforandroid/recipes/tflite-runtime/__init__.py @@ -1,4 +1,4 @@ -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 @@ -6,7 +6,6 @@ class TFLiteRuntimeRecipe(PythonRecipe): - ############################################################### # # tflite-runtime README: @@ -30,16 +29,14 @@ class TFLiteRuntimeRecipe(PythonRecipe): patches = ['CMakeLists.patch', 'build_with_cmake.patch'] 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): @@ -65,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')