1+ # ruff: noqa: RUF012
12import os
23import shutil
3- from typing import Any
4+ from typing import Any , override
45
5- import sh # type: ignore
6- from pythonforandroid .archs import Arch # type: ignore
7- from pythonforandroid .logger import shprint # type: ignore
8- from pythonforandroid .recipe import NDKRecipe , Recipe # type: ignore
9- from pythonforandroid .util import current_directory # type: ignore
6+ import sh
7+ from pythonforandroid .archs import Arch
8+ from pythonforandroid .logger import shprint
9+ from pythonforandroid .recipe import NDKRecipe , Recipe
10+ from pythonforandroid .util import current_directory
1011
1112
12- class LibbladerfRecipe (NDKRecipe ): # type: ignore
13+ class LibbladerfRecipe (NDKRecipe ):
1314
1415 url = 'git+https://github.com/Nuand/bladeRF.git'
15- version = 'f81b82aa8e75ee8866d1aede2a09191d92399829 '
16- patches = ( 'bladerf_android.patch' , )
17- generated_libraries = ( 'libbladerf.so' , )
16+ version = 'bb26efdd207ee185b3f7b72f8835d7e49384ae1c '
17+ generated_libraries = [ 'libbladerf.so' ]
18+ patches = [ 'bladerf_android.patch' ]
1819 site_packages_name = 'libbladerf'
1920 library_version_major = '2'
20- library_version_minor = '5 '
21- library_version_patch = '1 '
21+ library_version_minor = '6 '
22+ library_version_patch = '0 '
2223
23- depends = ( 'libusb' , )
24+ depends = [ 'libusb' ]
2425 name = 'libbladerf'
2526
27+ @override
2628 def should_build (self , arch : Arch ) -> bool :
2729 return not os .path .exists (os .path .join (self .ctx .get_libs_dir (arch .arch ), 'libbladerf.so' ))
2830
31+ @override
2932 def prebuild_arch (self , arch : Arch ) -> None :
3033 super ().prebuild_arch (arch )
3134
@@ -60,19 +63,23 @@ def prebuild_arch(self, arch: Arch) -> None:
6063 os .path .join (self .get_recipe_dir (), 'pre_install.cmake' ),
6164 )
6265
63- def get_recipe_env (self , arch : Arch ) -> dict [str , Any ]:
64- env : dict [str , Any ] = super ().get_recipe_env (arch )
65- env ['LDFLAGS' ] += f'-L{ self .ctx .get_libs_dir (arch .arch )} '
66+ @override
67+ def get_recipe_env (self , arch : Arch , ** kwargs : Any ) -> dict [str , Any ]:
68+ env : dict [str , Any ] = super ().get_recipe_env (arch , ** kwargs )
69+ env ['LDFLAGS' ] = env ['LDFLAGS' ] + f'-L{ self .ctx .get_libs_dir (arch .arch )} '
6670
6771 return env
6872
73+ @override
6974 def get_jni_dir (self , arch : Arch ) -> str :
7075 return os .path .join (self .get_build_dir (arch .arch ), 'android' , 'jni' )
7176
77+ @override
7278 def get_lib_dir (self , arch : Arch ) -> str :
7379 return os .path .join (self .get_build_dir (arch .arch ), 'android' , 'obj' , 'local' , arch .arch )
7480
75- def build_arch (self , arch : Arch , * extra_args : Any ) -> None :
81+ @override
82+ def build_arch (self , arch : Arch , * args : Any ) -> None :
7683 env = self .get_recipe_env (arch )
7784
7885 shutil .copyfile (os .path .join (self .ctx .get_libs_dir (arch .arch ), 'libusb1.0.so' ), os .path .join (self .get_build_dir (arch .arch ), 'android' , 'jni' , 'libusb1.0.so' ))
@@ -85,7 +92,7 @@ def build_arch(self, arch: Arch, *extra_args: Any) -> None:
8592 'APP_PLATFORM=android-' + str (self .ctx .ndk_api ),
8693 'NDK=' + self .ctx .ndk_dir ,
8794 'APP_ABI=' + arch .arch ,
88- * extra_args ,
95+ * args ,
8996 _env = env ,
9097 )
9198
0 commit comments