-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path__init__.py
More file actions
40 lines (29 loc) · 1.32 KB
/
__init__.py
File metadata and controls
40 lines (29 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# ruff: noqa: RUF012
import os
from typing import Any
from pythonforandroid.archs import Arch
from pythonforandroid.recipe import (
PyProjectRecipe,
Recipe,
)
class PythonHackrfRecipe(PyProjectRecipe):
url = 'https://github.com/GvozdevLeonid/python_hackrf/releases/download/v.{version}/python_hackrf-{version}.tar.gz'
depends = ['python3', 'setuptools', 'numpy', 'pyjnius', 'libhackrf']
hostpython_prerequisites = ['Cython>=3.1.0,<3.2']
site_packages_name = 'python_hackrf'
name = 'python_hackrf'
version = '1.5.0'
def get_recipe_env(self, arch: Arch, **kwargs) -> dict[str, Any]:
env: dict[str, Any] = super().get_recipe_env(arch, **kwargs)
libhackrf_recipe = Recipe.get_recipe('libhackrf', arch)
libhackrf_h_dir = os.path.join(libhackrf_recipe.get_build_dir(arch), 'host', 'libhackrf', 'src')
env['LDFLAGS'] = env['LDFLAGS'] + f' -L{self.ctx.get_libs_dir(arch.arch)} -lhackrf'
env['CFLAGS'] = env['CFLAGS'] + f' -I{libhackrf_h_dir}'
env['PYTHON_HACKRF_LIBHACKRF_H_PATH'] = libhackrf_h_dir
env['LDSHARED'] = env['CC'] + ' -shared'
env['LIBLINK'] = 'NOTNONE'
return env
def build_arch(self, arch: Arch) -> None:
super().build_arch(arch)
self.restore_hostpython_prerequisites(['cython'])
recipe = PythonHackrfRecipe()