Skip to content

Commit

Permalink
Merge pull request #3016 from T-Dynamos/pyreqwest_impersonate
Browse files Browse the repository at this point in the history
recipes: add new `pyreqwest_impersonate` recipe
  • Loading branch information
AndreMiras authored May 22, 2024
2 parents 87a32be + 32652a4 commit 344fd34
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pythonforandroid/recipes/pyreqwest_impersonate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from pythonforandroid.logger import info
from pythonforandroid.recipe import RustCompiledComponentsRecipe


class Pyreqwest_impersonateRecipe(RustCompiledComponentsRecipe):
version = "v0.4.5"
url = "https://github.com/deedy5/pyreqwest_impersonate/archive/refs/tags/{version}.tar.gz"

def get_recipe_env_post(self, arch, **kwargs):
env = super().get_recipe_env(arch, **kwargs)
env["ANDROID_NDK_HOME"] = self.ctx.ndk.llvm_prebuilt_dir
return env

def get_recipe_env_pre(self, arch, **kwargs):
env = super().get_recipe_env(arch, **kwargs)
env["ANDROID_NDK_HOME"] = self.ctx.ndk_dir
return env

def build_arch(self, arch):
# Why need of two env?
# Because there are two dependencies which accepts
# different ANDROID_NDK_HOME
self.get_recipe_env = self.get_recipe_env_pre
prebuild_ = super().build_arch
try:
prebuild_(arch)
except Exception:
info("pyreqwest_impersonate first build failed, as expected")
self.get_recipe_env = self.get_recipe_env_post
prebuild_(arch)


recipe = Pyreqwest_impersonateRecipe()

0 comments on commit 344fd34

Please sign in to comment.