Skip to content

Commit 8cf51bf

Browse files
committed
recipes: add pyreqwest_impersonate recipe
1 parent 82f5e02 commit 8cf51bf

File tree

1 file changed

+33
-0
lines changed
  • pythonforandroid/recipes/pyreqwest_impersonate

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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()

0 commit comments

Comments
 (0)