File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
pythonforandroid/recipes/pyreqwest_impersonate Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ from pythonforandroid .logger import info
2+ from pythonforandroid .recipe import RustCompiledComponentsRecipe
3+
4+
5+ class Pyreqwest_impersonateRecipe (RustCompiledComponentsRecipe ):
6+ version = "v0.4.5"
7+ url = "https://github.com/deedy5/pyreqwest_impersonate/archive/refs/tags/{version}.tar.gz"
8+
9+ def get_recipe_env_post (self , arch , ** kwargs ):
10+ env = super ().get_recipe_env (arch , ** kwargs )
11+ env ["ANDROID_NDK_HOME" ] = self .ctx .ndk .llvm_prebuilt_dir
12+ return env
13+
14+ def get_recipe_env_pre (self , arch , ** kwargs ):
15+ env = super ().get_recipe_env (arch , ** kwargs )
16+ env ["ANDROID_NDK_HOME" ] = self .ctx .ndk_dir
17+ return env
18+
19+ def build_arch (self , arch ):
20+ # Why need of two env?
21+ # Because there are two dependencies which accepts
22+ # different ANDROID_NDK_HOME
23+ self .get_recipe_env = self .get_recipe_env_pre
24+ prebuild_ = super ().build_arch
25+ try :
26+ prebuild_ (arch )
27+ except Exception :
28+ info ("pyreqwest_impersonate first build failed, as expected" )
29+ self .get_recipe_env = self .get_recipe_env_post
30+ prebuild_ (arch )
31+
32+
33+ recipe = Pyreqwest_impersonateRecipe ()
You can’t perform that action at this time.
0 commit comments