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 # 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
10+ from pythonforandroid .util import current_directory
1011
1112
12- class LibusbRecipe (NDKRecipe ): # type: ignore
13+ class LibusbRecipe (NDKRecipe ):
1314
1415 url = 'https://github.com/libusb/libusb/archive/refs/tags/v{version}.tar.gz'
15- generated_libraries = ( 'libusb-1.0.so' , )
16+ generated_libraries = [ 'libusb-1.0.so' ]
1617 site_packages_name = 'libusb'
1718 version = '1.0.26'
1819 name = 'libusb'
1920
21+ @override
2022 def should_build (self , arch : Arch ) -> bool :
2123 return not os .path .exists (os .path .join (self .ctx .get_libs_dir (arch .arch ), 'libusb1.0.so' ))
2224
25+ @override
2326 def get_jni_dir (self , arch : Arch ) -> str :
2427 return os .path .join (self .get_build_dir (arch .arch ), 'android' , 'jni' )
2528
29+ @override
2630 def get_lib_dir (self , arch : Arch ) -> str :
2731 return os .path .join (self .get_build_dir (arch .arch ), 'android' , 'obj' , 'local' , arch .arch )
2832
29- def build_arch (self , arch : Arch , * extra_args : Any ) -> None :
33+ @override
34+ def build_arch (self , arch : Arch , * args : Any ) -> None :
3035 env = self .get_recipe_env (arch )
3136 with current_directory (self .get_build_dir (arch .arch )):
3237 shprint (
@@ -35,7 +40,7 @@ def build_arch(self, arch: Arch, *extra_args: Any) -> None:
3540 'APP_PLATFORM=android-' + str (self .ctx .ndk_api ),
3641 'NDK=' + self .ctx .ndk_dir ,
3742 'APP_ABI=' + arch .arch ,
38- * extra_args ,
43+ * args ,
3944 _env = env ,
4045 )
4146
0 commit comments